Commit bf9d722b authored by Hallvard Furuseth's avatar Hallvard Furuseth
Browse files

mdb type cleanup: Consistent reader count types.

Use unsigned int for reader counts/max limits, that's the smallest
change.  Don't need uint32_t when mdb_env_set_maxreaders() takes less.
Change prototypes of mdb_env_set_maxreaders,mdb_env_get_maxreaders().
Check the mdb_env_set_maxreaders() argument.
parent 5f682934
......@@ -436,7 +436,7 @@ typedef struct MDB_txbody {
* This always records the maximum count, it is not decremented
* when readers release their slots.
*/
uint32_t mtb_numreaders;
unsigned mtb_numreaders;
/** The ID of the most recent meta page in the database.
* This is recorded here only for convenience; the value can always
* be determined by reading the main database meta pages.
......@@ -1819,16 +1819,16 @@ mdb_env_set_maxdbs(MDB_env *env, int dbs)
}
int
mdb_env_set_maxreaders(MDB_env *env, int readers)
mdb_env_set_maxreaders(MDB_env *env, unsigned int readers)
{
if (env->me_map)
if (env->me_map || readers < 1)
return EINVAL;
env->me_maxreaders = readers;
return MDB_SUCCESS;
}
int
mdb_env_get_maxreaders(MDB_env *env, int *readers)
mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers)
{
if (!env || !readers)
return EINVAL;
......
......@@ -414,7 +414,7 @@ int mdb_env_set_mapsize(MDB_env *env, size_t size);
* <li>EINVAL - an invalid parameter was specified, or the environment is already open.
* </ul>
*/
int mdb_env_set_maxreaders(MDB_env *env, int readers);
int mdb_env_set_maxreaders(MDB_env *env, unsigned int readers);
/** Get the maximum number of threads for the environment.
* @param[in] env An environment handle returned by #mdb_env_create()
......@@ -425,7 +425,7 @@ int mdb_env_set_maxreaders(MDB_env *env, int readers);
* <li>EINVAL - an invalid parameter was specified.
* </ul>
*/
int mdb_env_get_maxreaders(MDB_env *env, int *readers);
int mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers);
/** Set the maximum number of databases for the environment.
* This function is only needed if multiple databases will be used in the
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment