summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorroot <devnull@localhost>1996-02-15 23:13:08 +0000
committerroot <devnull@localhost>1996-02-15 23:13:08 +0000
commit3e32f9e73a9f088f9513e71bd1335bbe8ebbb533 (patch)
tree3833da7343693416ec84f49f4ef33891b9e36945 /lib
parent67a5d89bbec226f70a71aeb7a0bc5ca33a96360a (diff)
downloadrpm-3e32f9e73a9f088f9513e71bd1335bbe8ebbb533.tar.gz
rpm-3e32f9e73a9f088f9513e71bd1335bbe8ebbb533.tar.bz2
rpm-3e32f9e73a9f088f9513e71bd1335bbe8ebbb533.zip
make load/unload sort like read/write
fix type correction in getEntry() CVS patchset: 291 CVS date: 1996/02/15 23:13:08
Diffstat (limited to 'lib')
-rw-r--r--lib/header.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/header.c b/lib/header.c
index 7d02b8375..eb39ee54a 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -392,7 +392,8 @@ Header loadHeader(void *pv)
h->data_used = dl;
h->data = p;
- h->fully_sorted = 0;
+ /* This assumes you only loadHeader() something you unloadHeader()-ed */
+ h->fully_sorted = 1;
h->mutable = 0;
return h;
@@ -402,6 +403,7 @@ void *unloadHeader(Header h)
{
void *p;
int_32 *pi;
+ Header res;
pi = p = malloc(2 * sizeof(int_32) +
h->entries_used * sizeof(struct indexEntry) +
@@ -413,6 +415,9 @@ void *unloadHeader(Header h)
pi += h->entries_used * sizeof(struct indexEntry);
memcpy(pi, h->data, h->data_used);
+ res = copyHeader(p);
+ free(p);
+
return p;
}
@@ -642,7 +647,9 @@ int getEntry(Header h, int_32 tag, int_32 * type, void **p, int_32 * c)
/* Fall through to STRING_ARRAY_TYPE */
case STRING_ARRAY_TYPE:
/* Correction! */
- *type = STRING_ARRAY_TYPE;
+ if (type) {
+ *type = STRING_ARRAY_TYPE;
+ }
/* Otherwise, build up an array of char* to return */
x = index->count;
*p = malloc(x * sizeof(char *));