svn commit: samba r21973 - in branches/SAMBA_3_0/source/intl: .

metze at samba.org metze at samba.org
Tue Mar 27 09:12:48 GMT 2007


Author: metze
Date: 2007-03-27 09:12:47 +0000 (Tue, 27 Mar 2007)
New Revision: 21973

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

Log:
make use of tdb_*_bystring() and string_term_tdb_data()
to avoid creating the TDB_DATA struct from strings "by hand"

metze
Modified:
   branches/SAMBA_3_0/source/intl/lang_tdb.c


Changeset:
Modified: branches/SAMBA_3_0/source/intl/lang_tdb.c
===================================================================
--- branches/SAMBA_3_0/source/intl/lang_tdb.c	2007-03-27 08:41:45 UTC (rev 21972)
+++ branches/SAMBA_3_0/source/intl/lang_tdb.c	2007-03-27 09:12:47 UTC (rev 21973)
@@ -32,7 +32,7 @@
 	char **lines;
 	int num_lines, i;
 	char *msgid, *msgstr;
-	TDB_DATA key, data;
+	TDB_DATA data;
 
 	lines = file_lines_load(msg_file, &num_lines,0);
 
@@ -63,11 +63,8 @@
 			}
 			all_string_sub(msgid, "\\n", "\n", 0);
 			all_string_sub(msgstr, "\\n", "\n", 0);
-			key.dptr = msgid;
-			key.dsize = strlen(msgid)+1;
-			data.dptr = msgstr;
-			data.dsize = strlen(msgstr)+1;
-			tdb_store(tdb, key, data, 0);
+			data = string_term_tdb_data(msgstr);
+			tdb_store_bystring(tdb, msgid, data, 0);
 			msgid = NULL;
 		}
 	}
@@ -178,7 +175,7 @@
 */
 const char *lang_msg(const char *msgid)
 {
-	TDB_DATA key, data;
+	TDB_DATA data;
 	const char *p;
 	char *q, *msgid_quoted;
 	int count;
@@ -214,10 +211,7 @@
 
 	*q = 0;
 
-	key.dptr = (char *)msgid_quoted;
-	key.dsize = strlen(msgid_quoted)+1;
-	
-	data = tdb_fetch(tdb, key);
+	data = tdb_fetch_bystring(tdb, msgid_quoted);
 
 	free(msgid_quoted);
 



More information about the samba-cvs mailing list