summaryrefslogtreecommitdiff
path: root/lib/db1.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-04-29 01:05:43 +0000
committerjbj <devnull@localhost>2001-04-29 01:05:43 +0000
commit3b5820c4205e440d9aad5c5d626721ee30b12292 (patch)
treeb1f0a694903aef1dd937539e1b06c8b0947fb67c /lib/db1.c
parent6a0524ed57548de92daa4b6cf8ee9d2ab39d7a42 (diff)
downloadlibrpm-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.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/db1.c b/lib/db1.c
index 0e5702a93..0e841505f 100644
--- a/lib/db1.c
+++ b/lib/db1.c
@@ -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;
}