svn commit: samba r21979 - in branches/SAMBA_3_0/source/registry: .

metze at samba.org metze at samba.org
Tue Mar 27 10:15:46 GMT 2007


Author: metze
Date: 2007-03-27 10:15:45 +0000 (Tue, 27 Mar 2007)
New Revision: 21979

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21979

Log:
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
Modified:
   branches/SAMBA_3_0/source/registry/reg_perfcount.c


Changeset:
Modified: branches/SAMBA_3_0/source/registry/reg_perfcount.c
===================================================================
--- branches/SAMBA_3_0/source/registry/reg_perfcount.c	2007-03-27 10:13:53 UTC (rev 21978)
+++ branches/SAMBA_3_0/source/registry/reg_perfcount.c	2007-03-27 10:15:45 UTC (rev 21979)
@@ -98,8 +98,7 @@
 	   even_num+1 perf_counter<even_num>_help
 	   and so on.
 	   So last_counter becomes num_counters*2, and last_help will be last_counter+1 */
-	kbuf.dptr = key;
-	kbuf.dsize = strlen(key);
+	kbuf = string_tdb_data(key);
 	dbuf = tdb_fetch(names, kbuf);
 	if(dbuf.dptr == NULL)
 	{
@@ -166,8 +165,7 @@
 
 	memset(temp, 0, sizeof(temp));
 	snprintf(temp, sizeof(temp), "%d", keyval);
-	kbuf.dptr = temp;
-	kbuf.dsize = strlen(temp);
+	kbuf = string_tdb_data(temp);
 	dbuf = tdb_fetch(tdb, kbuf);
 	if(dbuf.dptr == NULL)
 	{
@@ -309,8 +307,7 @@
 	else 
 		snprintf(buf, buflen, "%d", key_part1);
 
-	key->dptr = buf;
-	key->dsize = strlen(buf);
+	*key = string_tdb_data(buf);
 
 	return;
 }



More information about the samba-cvs mailing list