From a7edb95e6496bb65eed291fffc1eb11fbf60f7cd Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 9 Sep 2011 03:52:12 -0700 Subject: [PATCH] Minor typos, additional clarification --- libraries/libmdb/mdb.c | 6 +++--- libraries/libmdb/mdb.h | 26 ++++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 21c71b2cdc..1363ca4f2a 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -316,8 +316,8 @@ typedef uint16_t indx_t; * Since the database uses multi-version concurrency control, readers don't * actually need any locking. This table is used to keep track of which * readers are using data from which old transactions, so that we'll know - * when a particular old transaction is no longer in use, Old transactions - * that have freed any data pages can then have their freed pages reclaimed + * when a particular old transaction is no longer in use. Old transactions + * that have discarded any data pages can then have those pages reclaimed * for use by a later write transaction. * * The lock table is constructed such that reader slots are aligned with the @@ -886,7 +886,7 @@ mdb_strerror(int err) * @param[in] buf the buffer to write into. Should always be #DKBUF. * @return The key in hexadecimal form. */ -static char * +char * mdb_dkey(MDB_val *key, char *buf) { char *ptr = buf; diff --git a/libraries/libmdb/mdb.h b/libraries/libmdb/mdb.h index 7662c08d29..3b5d74f00e 100644 --- a/libraries/libmdb/mdb.h +++ b/libraries/libmdb/mdb.h @@ -152,11 +152,7 @@ typedef void (MDB_rel_func)(void *newptr, void *oldptr, size_t size); /** use sorted duplicates */ #define MDB_DUPSORT 0x04 /** numeric keys in native byte order. - * @note The keys size must actually be equal to - * sizeof(int) or sizeof(long) otherwise there will be - * alignment issues. On some processors, accessing misaligned - * data will cause a SIGBUS. - */ + * The keys must all be of the same size. */ #define MDB_INTEGERKEY 0x08 /** with #MDB_DUPSORT, sorted dup items have fixed size */ #define MDB_DUPFIXED 0x10 @@ -205,7 +201,7 @@ typedef enum MDB_cursor_op { MDB_PREV_DUP, /**< Position at previous data item of current key. Only for #MDB_DUPSORT */ MDB_PREV_NODUP, /**< Position at last data item of previous key. - only for #MDB_DUPSORT */ + Only for #MDB_DUPSORT */ MDB_SET, /**< Position at specified key */ MDB_SET_RANGE /**< Position at first key greater than or equal to specified key. */ } MDB_cursor_op; @@ -498,7 +494,7 @@ void mdb_txn_abort(MDB_txn *txn); /** Reset a read-only transaction. * This releases the current reader lock but doesn't free the * transaction handle, allowing it to be used again later by #mdb_txn_renew(). - * It otherwise has the same affect as #mdb_txn_abort() but saves some memory + * It otherwise has the same effect as #mdb_txn_abort() but saves some memory * allocation/deallocation overhead if a thread is going to start a new * read-only transaction again soon. * All cursors opened within the transaction must be closed before the transaction @@ -544,11 +540,9 @@ int mdb_txn_renew(MDB_txn *txn); * keys may have multiple data items, stored in sorted order.) By default * keys must be unique and may have only a single data item. *
  • #MDB_INTEGERKEY - * Keys are binary integers in native byte order. On Big-Endian systems - * this flag has no effect. On Little-Endian systems this flag behaves - * the same as #MDB_REVERSEKEY. This flag is simply provided as a - * convenience so that applications don't need to detect Endianness themselves - * when using integers as keys. + * Keys are binary integers in native byte order. Setting this option + * requires all keys to be the same size, typically sizeof(int) + * or sizeof(long). *
  • #MDB_DUPFIXED * This flag may only be used in combination with #MDB_DUPSORT. This option * tells the library that the data items for this database are all the same @@ -558,6 +552,9 @@ int mdb_txn_renew(MDB_txn *txn); *
  • #MDB_INTEGERDUP * This option specifies that duplicate data items are also integers, and * should be sorted as such. + *
  • #MDB_REVERSEDUP + * This option specifies that duplicate data items should be compared as + * strings in reverse order. *
  • #MDB_CREATE * Create the named database if it doesn't exist. This option is not * allowed in a read-only transaction or a read-only environment. @@ -660,6 +657,11 @@ int mdb_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel); * If the database supports duplicate keys (#MDB_DUPSORT) then the * first data item for the key will be returned. Retrieval of other * items requires the use of #mdb_cursor_get(). + * + * @note The memory pointed to by the returned values is owned by the + * database. The caller need not dispose of the memory, and may not + * modify it in any way. For values returned in a read-only transaction + * any modification attempts will cause a SIGSEGV. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_open() * @param[in] key The key to search for in the database -- 2.39.5