mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
mdbx: minor misc cosmetics & refines.
Change-Id: I84b70aeded047ab3786a57c864dbc89364969afa
This commit is contained in:
parent
860aa017db
commit
75a4463811
10
src/core.c
10
src/core.c
@ -15926,7 +15926,7 @@ int mdbx_put(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data,
|
|||||||
#ifndef MDBX_WBUF
|
#ifndef MDBX_WBUF
|
||||||
#define MDBX_WBUF ((size_t)1024 * 1024)
|
#define MDBX_WBUF ((size_t)1024 * 1024)
|
||||||
#endif
|
#endif
|
||||||
#define MDBX_EOF 0x10 /* mdbx_env_copyfd1() is done reading */
|
#define MDBX_EOF 0x10 /* mdbx_env_copythr() is done reading */
|
||||||
|
|
||||||
/* State needed for a double-buffering compacting copy. */
|
/* State needed for a double-buffering compacting copy. */
|
||||||
typedef struct mdbx_copy {
|
typedef struct mdbx_copy {
|
||||||
@ -17551,7 +17551,7 @@ int __cold mdbx_reader_list(const MDBX_env *env, MDBX_reader_list_func *func,
|
|||||||
|
|
||||||
/* Insert pid into list if not already present.
|
/* Insert pid into list if not already present.
|
||||||
* return -1 if already present. */
|
* return -1 if already present. */
|
||||||
static int __cold mdbx_pid_insert(uint32_t *ids, uint32_t pid) {
|
static bool __cold mdbx_pid_insert(uint32_t *ids, uint32_t pid) {
|
||||||
/* binary search of pid in list */
|
/* binary search of pid in list */
|
||||||
unsigned base = 0;
|
unsigned base = 0;
|
||||||
unsigned cursor = 1;
|
unsigned cursor = 1;
|
||||||
@ -17570,7 +17570,7 @@ static int __cold mdbx_pid_insert(uint32_t *ids, uint32_t pid) {
|
|||||||
n -= pivot + 1;
|
n -= pivot + 1;
|
||||||
} else {
|
} else {
|
||||||
/* found, so it's a duplicate */
|
/* found, so it's a duplicate */
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17581,7 +17581,7 @@ static int __cold mdbx_pid_insert(uint32_t *ids, uint32_t pid) {
|
|||||||
for (n = ids[0]; n > cursor; n--)
|
for (n = ids[0]; n > cursor; n--)
|
||||||
ids[n] = ids[n - 1];
|
ids[n] = ids[n - 1];
|
||||||
ids[n] = pid;
|
ids[n] = pid;
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __cold mdbx_reader_check(MDBX_env *env, int *dead) {
|
int __cold mdbx_reader_check(MDBX_env *env, int *dead) {
|
||||||
@ -17627,7 +17627,7 @@ MDBX_INTERNAL_FUNC int __cold mdbx_reader_check0(MDBX_env *env, int rdt_locked,
|
|||||||
continue /* skip empty */;
|
continue /* skip empty */;
|
||||||
if (pid == env->me_pid)
|
if (pid == env->me_pid)
|
||||||
continue /* skip self */;
|
continue /* skip self */;
|
||||||
if (mdbx_pid_insert(pids, pid) != 0)
|
if (!mdbx_pid_insert(pids, pid))
|
||||||
continue /* such pid already processed */;
|
continue /* such pid already processed */;
|
||||||
|
|
||||||
int err = mdbx_rpid_check(env, pid);
|
int err = mdbx_rpid_check(env, pid);
|
||||||
|
@ -703,7 +703,7 @@ static int process_db(MDBX_dbi dbi_handle, char *dbi_name, visitor *handler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!silent && verbose) {
|
if (!silent && verbose) {
|
||||||
print(" - kind: %s => %s", db_flags2keymode(flags),
|
print(" - key-value kind: %s => %s", db_flags2keymode(flags),
|
||||||
db_flags2valuemode(flags));
|
db_flags2valuemode(flags));
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
print(", flags:");
|
print(", flags:");
|
||||||
|
@ -384,7 +384,7 @@ int main(int argc, char *argv[]) {
|
|||||||
printf(" GC: %" PRIu64 " %.1f%%\n", value, value / percent);
|
printf(" GC: %" PRIu64 " %.1f%%\n", value, value / percent);
|
||||||
|
|
||||||
value = pages - reclaimable;
|
value = pages - reclaimable;
|
||||||
printf(" Detained: %" PRIu64 " %.1f%%\n", value, value / percent);
|
printf(" Retained: %" PRIu64 " %.1f%%\n", value, value / percent);
|
||||||
|
|
||||||
value = reclaimable;
|
value = reclaimable;
|
||||||
printf(" Reclaimable: %" PRIu64 " %.1f%%\n", value, value / percent);
|
printf(" Reclaimable: %" PRIu64 " %.1f%%\n", value, value / percent);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user