summaryrefslogtreecommitdiff
path: root/source3/tdb
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2000-05-12 06:27:35 +0000
committerTim Potter <tpot@samba.org>2000-05-12 06:27:35 +0000
commit4cdc54ba244f72a4a143e7a0e0c0b4fcfaa13d3c (patch)
treeca65489e43e909ee8e5dbda7a50c415c40fc8d45 /source3/tdb
parent7738941ccf4ebcaccea872619c465a45fb7bf0ae (diff)
downloadsamba-4cdc54ba244f72a4a143e7a0e0c0b4fcfaa13d3c.tar.gz
samba-4cdc54ba244f72a4a143e7a0e0c0b4fcfaa13d3c.tar.bz2
samba-4cdc54ba244f72a4a143e7a0e0c0b4fcfaa13d3c.zip
While we're all making incompatible tdb changes, I changed the implementation
of tdb_{store,get}_int() to store the length of the string key + 1 so the stored key contains the trailing NULL character. This allows normal string library routines to manipulate keys. Also renamed tdb_get_int() to tdb_fetch_int() to keep the set of verbs consistent. (This used to be commit a423c7c5f21dc4046530b85482dee88dcfcbf070)
Diffstat (limited to 'source3/tdb')
-rw-r--r--source3/tdb/tdbutil.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c
index d7cc7f8b2a..2546b9d88c 100644
--- a/source3/tdb/tdbutil.c
+++ b/source3/tdb/tdbutil.c
@@ -26,7 +26,7 @@
/* fetch a value by a arbitrary blob key, return -1 if not found */
-int tdb_get_int_byblob(TDB_CONTEXT *tdb, char *keyval, size_t len)
+int tdb_fetch_int_byblob(TDB_CONTEXT *tdb, char *keyval, size_t len)
{
TDB_DATA key, data;
int ret;
@@ -42,9 +42,9 @@ int tdb_get_int_byblob(TDB_CONTEXT *tdb, char *keyval, size_t len)
}
/* fetch a value by string key, return -1 if not found */
-int tdb_get_int(TDB_CONTEXT *tdb, char *keystr)
+int tdb_fetch_int(TDB_CONTEXT *tdb, char *keystr)
{
- return tdb_get_int_byblob(tdb, keystr, strlen(keystr));
+ return tdb_fetch_int_byblob(tdb, keystr, strlen(keystr) + 1);
}
/* store a value by an arbitary blob key, return 0 on success, -1 on failure */
@@ -63,7 +63,7 @@ int tdb_store_int_byblob(TDB_CONTEXT *tdb, char *keystr, size_t len, int v)
/* store a value by string key, return 0 on success, -1 on failure */
int tdb_store_int(TDB_CONTEXT *tdb, char *keystr, int v)
{
- return tdb_store_int_byblob(tdb, keystr, strlen(keystr), v);
+ return tdb_store_int_byblob(tdb, keystr, strlen(keystr) + 1, v);
}
/* Store a buffer by a null terminated string key. Return 0 on success, -1