summaryrefslogtreecommitdiffstats
path: root/source/tdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-07 02:38:42 +0000
committerJeremy Allison <jra@samba.org>2002-11-07 02:38:42 +0000
commit10024ed06e9d91f24fdc78d59eef2f76bf395438 (patch)
tree00f4386c8a2c58e9b6cc2dfd90c446c9d8e84113 /source/tdb
parent8a6d37752182e0de7fd04b2c31f90e145dde783b (diff)
downloadsamba-10024ed06e9d91f24fdc78d59eef2f76bf395438.tar.gz
samba-10024ed06e9d91f24fdc78d59eef2f76bf395438.tar.xz
samba-10024ed06e9d91f24fdc78d59eef2f76bf395438.zip
Merge of scalable printing code fix... Needs testing.
Also tidied up some of Richard's code (I don't think he uses the compiler flags -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual like I do :-) :-). Jeremy.
Diffstat (limited to 'source/tdb')
-rw-r--r--source/tdb/tdb.c3
-rw-r--r--source/tdb/tdbutil.c19
2 files changed, 10 insertions, 12 deletions
diff --git a/source/tdb/tdb.c b/source/tdb/tdb.c
index c57d23cb6f5..2a6dca16a8e 100644
--- a/source/tdb/tdb.c
+++ b/source/tdb/tdb.c
@@ -1442,7 +1442,8 @@ int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag)
}
memcpy(p, key.dptr, key.dsize);
- memcpy(p+key.dsize, dbuf.dptr, dbuf.dsize);
+ if (dbuf.dsize)
+ memcpy(p+key.dsize, dbuf.dptr, dbuf.dsize);
/* now we're into insert / modify / replace of a record which
* we know could not be optimised by an in-place store (for
diff --git a/source/tdb/tdbutil.c b/source/tdb/tdbutil.c
index e7650033b87..ad97f450445 100644
--- a/source/tdb/tdbutil.c
+++ b/source/tdb/tdbutil.c
@@ -218,17 +218,14 @@ BOOL tdb_store_uint32(TDB_CONTEXT *tdb, char *keystr, uint32 value)
on failure.
****************************************************************************/
-int tdb_store_by_string(TDB_CONTEXT *tdb, char *keystr, void *buffer, int len)
+int tdb_store_by_string(TDB_CONTEXT *tdb, char *keystr, TDB_DATA data, int flags)
{
- TDB_DATA key, data;
+ TDB_DATA key;
key.dptr = keystr;
key.dsize = strlen(keystr) + 1;
- data.dptr = buffer;
- data.dsize = len;
-
- return tdb_store(tdb, key, data, TDB_REPLACE);
+ return tdb_store(tdb, key, data, flags);
}
/****************************************************************************
@@ -247,17 +244,17 @@ TDB_DATA tdb_fetch_by_string(TDB_CONTEXT *tdb, char *keystr)
}
/****************************************************************************
- Delete a buffer using a null terminated string key.
+ Delete an entry using a null terminated string key.
****************************************************************************/
int tdb_delete_by_string(TDB_CONTEXT *tdb, char *keystr)
{
- TDB_DATA key;
+ TDB_DATA key;
- key.dptr = keystr;
- key.dsize = strlen(keystr) + 1;
+ key.dptr = keystr;
+ key.dsize = strlen(keystr) + 1;
- return tdb_delete(tdb, key);
+ return tdb_delete(tdb, key);
}
/****************************************************************************