1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

r21979: make use of string_tdb_data()

to avoid creating the TDB_DATA struct from strings "by hand"

note: we can't use the tdb_*_bystring functions here, as the key isn't
null-terminated here...

metze
(This used to be commit 29b42ea89c)
This commit is contained in:
Stefan Metzmacher 2007-03-27 10:15:45 +00:00 committed by Gerald (Jerry) Carter
parent 4d7c7bb689
commit c2f09ee288

View File

@ -98,8 +98,7 @@ uint32 reg_perfcount_get_base_index(void)
even_num+1 perf_counter<even_num>_help even_num+1 perf_counter<even_num>_help
and so on. and so on.
So last_counter becomes num_counters*2, and last_help will be last_counter+1 */ So last_counter becomes num_counters*2, and last_help will be last_counter+1 */
kbuf.dptr = key; kbuf = string_tdb_data(key);
kbuf.dsize = strlen(key);
dbuf = tdb_fetch(names, kbuf); dbuf = tdb_fetch(names, kbuf);
if(dbuf.dptr == NULL) if(dbuf.dptr == NULL)
{ {
@ -166,8 +165,7 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb,
memset(temp, 0, sizeof(temp)); memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%d", keyval); snprintf(temp, sizeof(temp), "%d", keyval);
kbuf.dptr = temp; kbuf = string_tdb_data(temp);
kbuf.dsize = strlen(temp);
dbuf = tdb_fetch(tdb, kbuf); dbuf = tdb_fetch(tdb, kbuf);
if(dbuf.dptr == NULL) if(dbuf.dptr == NULL)
{ {
@ -309,8 +307,7 @@ static void _reg_perfcount_make_key(TDB_DATA *key,
else else
snprintf(buf, buflen, "%d", key_part1); snprintf(buf, buflen, "%d", key_part1);
key->dptr = buf; *key = string_tdb_data(buf);
key->dsize = strlen(buf);
return; return;
} }