]> git.draconx.ca Git - upkg.git/commitdiff
Remove redundant index field from upkg_name and fix some types.
authorNick Bowler <nbowler@draconx.ca>
Fri, 5 Jun 2009 15:27:08 +0000 (11:27 -0400)
committerNick Bowler <nbowler@draconx.ca>
Fri, 5 Jun 2009 15:27:08 +0000 (11:27 -0400)
libupkg.c
upkg.c

index b932d861f0a52df6faccbdf7e0f6fe5800acc858..118e04f40631819ee72eb9a8870299156d045eb9 100644 (file)
--- a/libupkg.c
+++ b/libupkg.c
@@ -6,7 +6,7 @@
 #include "pack.h"
 
 struct upkg_name {
-       unsigned long index, flags;
+       unsigned long flags;
        char *name;
 };
 
@@ -19,16 +19,6 @@ struct upkg_private {
        unsigned char guid[16];
 };
 
-static int namecmp(const void *_a, const void *_b, void *_pkg)
-{
-       const struct upkg_name *a = _a, *b = _b;
-       if (a->index < b->index)
-               return -1;
-       if (a->index > b->index)
-               return -1;
-       return 0;
-}
-
 static long decode_index(unsigned char *bytes)
 {
        long val = 0;
@@ -73,7 +63,7 @@ static struct upkg *init_upkg(unsigned char hdr[static UPKG_HDR_SIZE])
 
 static int pkg_init_names(struct upkg *pkg)
 {
-       size_t rc, nbuf = 0, len;
+       size_t rc, len, nbuf = 0;
        unsigned long index = 0;
        char buf[512];
 
@@ -86,7 +76,6 @@ static int pkg_init_names(struct upkg *pkg)
 
        while (index < pkg->name_count) {
                struct upkg_name *name = &pkg->priv->names[index];
-               name->index = index;
 
                /* Read some data into buffer. */
                if (!feof(pkg->priv->f)) {
diff --git a/upkg.c b/upkg.c
index 970de567e59b903d9f98fe8fed56b141573d3859..d7b181de515d08b8135b98acebd3cdc62219c301 100644 (file)
--- a/upkg.c
+++ b/upkg.c
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
        printf("Flags:   %lx\n", pkg->flags);
        print_upkg_flags("\t", pkg->flags);
 
-       printf("Names:   %zu\n", pkg->name_count);
+       printf("Names:   %lu\n", pkg->name_count);
        for (unsigned long i = 0; i < pkg->name_count; i++) {
                printf("\t%s\n", upkg_get_name(pkg, i));
        }