diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-03-27 09:12:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:54 -0500 |
commit | 0563eb86b36f79eba33c38a11dc9dd1423c1be40 (patch) | |
tree | 0754c9cafb02916ce7b9edf1bc51d62e7a97535b | |
parent | 2aee3c26891e1fee94c26384231a54ec89789abd (diff) | |
download | samba-0563eb86b36f79eba33c38a11dc9dd1423c1be40.tar.gz samba-0563eb86b36f79eba33c38a11dc9dd1423c1be40.tar.bz2 samba-0563eb86b36f79eba33c38a11dc9dd1423c1be40.zip |
r21973: make use of tdb_*_bystring() and string_term_tdb_data()
to avoid creating the TDB_DATA struct from strings "by hand"
metze
(This used to be commit 9756b7ea084139e74061e98416716acd9d1aedfa)
-rw-r--r-- | source3/intl/lang_tdb.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/source3/intl/lang_tdb.c b/source3/intl/lang_tdb.c index ddb3d4d65e..2ccd2073db 100644 --- a/source3/intl/lang_tdb.c +++ b/source3/intl/lang_tdb.c @@ -32,7 +32,7 @@ static BOOL load_msg(const char *msg_file) 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 @@ static BOOL load_msg(const char *msg_file) } 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 @@ BOOL lang_tdb_init(const char *lang) */ 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 @@ const char *lang_msg(const char *msgid) *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); |