diff options
author | jbj <devnull@localhost> | 2001-04-29 01:05:43 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-04-29 01:05:43 +0000 |
commit | 3b5820c4205e440d9aad5c5d626721ee30b12292 (patch) | |
tree | b1f0a694903aef1dd937539e1b06c8b0947fb67c /lib/db1.c | |
parent | 6a0524ed57548de92daa4b6cf8ee9d2ab39d7a42 (diff) | |
download | librpm-tizen-3b5820c4205e440d9aad5c5d626721ee30b12292.tar.gz librpm-tizen-3b5820c4205e440d9aad5c5d626721ee30b12292.tar.bz2 librpm-tizen-3b5820c4205e440d9aad5c5d626721ee30b12292.zip |
- globalize _free(3) wrapper in rpmlib.h, consistent usage throughout.
- internalize locale insensitive ctype(3) in rpmio.h
- boring lclint annotations and fiddles.
CVS patchset: 4721
CVS date: 2001/04/29 01:05:43
Diffstat (limited to 'lib/db1.c')
-rw-r--r-- | lib/db1.c | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -35,6 +35,7 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */ #include "debug.h" +/*@access Header@*/ /* XXX compared with NULL */ /*@access rpmdb@*/ /*@access dbiIndex@*/ /*@access dbiIndexSet@*/ @@ -52,7 +53,7 @@ static inline DBTYPE db3_to_dbtype(int dbitype) /*@notreached@*/ return DB_HASH; } -static /*@observer@*/ const char * db_strerror(int error) +static /*@observer@*/ char * db_strerror(int error) { if (error == 0) return ("Successful return: 0"); @@ -69,8 +70,11 @@ static /*@observer@*/ const char * db_strerror(int error) * Note, however, we're no longer thread-safe if it does. */ static char ebuf[40]; + char * t = ebuf; - (void)snprintf(ebuf, sizeof(ebuf), "Unknown error: %d", error); + *t = '\0'; + t = stpcpy(t, "Unknown error: "); + sprintf(t, "%d", error); return(ebuf); } } @@ -190,7 +194,7 @@ static void * doGetRecord(FD_t pkgs, unsigned int offset) compressFilelist(h); exit: - if (h) { + if (h != NULL) { uh = headerUnload(h); headerFree(h); } @@ -392,10 +396,8 @@ static int db1close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags) } db3Free(dbi); - if (base) - free((void *)base); - if (urlfn) - free((void *)urlfn); + base = _free(base); + urlfn = _free(urlfn); return rc; } @@ -472,14 +474,8 @@ exit: } else db1close(dbi, 0); - if (base) { - free((void *)base); - base = NULL; - } - if (urlfn) { - free((void *)urlfn); - urlfn = NULL; - } + base = _free(base); + urlfn = _free(urlfn); return rc; } |