diff options
author | Volker Lendecke <vl@samba.org> | 2017-07-26 14:56:53 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-08-16 00:27:10 +0200 |
commit | ae28e4db441baff83e374086aa9c5a0c06435f92 (patch) | |
tree | 440e05586f87c0b4bc2c4c808dd865a7541f320c /lib/dbwrap | |
parent | a11450d825b756ca8880c6307e38a6ce072fff54 (diff) | |
download | samba-ae28e4db441baff83e374086aa9c5a0c06435f92.tar.gz |
dbwrap: Simplify dbwrap_store_int32_bystring
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/dbwrap')
-rw-r--r-- | lib/dbwrap/dbwrap_util.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c index 22f910de992..443a915df2d 100644 --- a/lib/dbwrap/dbwrap_util.c +++ b/lib/dbwrap/dbwrap_util.c @@ -77,23 +77,14 @@ NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr, NTSTATUS dbwrap_store_int32_bystring(struct db_context *db, const char *keystr, int32_t v) { - struct db_record *rec; - int32_t v_store; + uint8_t v_store[sizeof(int32_t)]; + TDB_DATA data = { .dptr = v_store, .dsize = sizeof(v_store) }; NTSTATUS status; - rec = dbwrap_fetch_locked(db, talloc_tos(), - string_term_tdb_data(keystr)); - if (rec == NULL) { - return NT_STATUS_UNSUCCESSFUL; - } - - SIVAL(&v_store, 0, v); + SIVAL(v_store, 0, v); - status = dbwrap_record_store(rec, - make_tdb_data((const uint8_t *)&v_store, - sizeof(v_store)), - TDB_REPLACE); - TALLOC_FREE(rec); + status = dbwrap_store(db, string_term_tdb_data(keystr), data, + TDB_REPLACE); return status; } |