small cleanups
authorMichael Schroeder <mls@suse.de>
Thu, 31 Jan 2013 15:49:15 +0000 (16:49 +0100)
committerMichael Schroeder <mls@suse.de>
Thu, 31 Jan 2013 15:49:15 +0000 (16:49 +0100)
ext/repo_arch.c
ext/repo_rpmmd.c

index ebf42d3..835899e 100644 (file)
@@ -196,14 +196,14 @@ static int gettarhead(struct tarhead *th)
            char *data, *pp;
            if (length < 1 || length >= 1024 * 1024)
              return -1;
-           l = length;
-           data = pp = solv_malloc(l + 512);
-           for (; l > 0; l -= 512, pp += 512)
+           data = pp = solv_malloc(length + 512);
+           for (l = length; l > 0; l -= 512, pp += 512)
              if (readblock(th->fp, (unsigned char *)pp))
                {
                  solv_free(data);
                  return -1;
                }
+           data[length] = 0;
            type = 3;           /* extension */
            if (th->blk[156] == 'L')
              {
@@ -216,7 +216,6 @@ static int gettarhead(struct tarhead *th)
            while (length > 0)
              {
                int ll = 0;
-               int l;
                for (l = 0; l < length && pp[l] >= '0' && pp[l] <= '9'; l++)
                  ll = ll * 10 + (pp[l] - '0');
                if (l == length || pp[l] != ' ' || ll < 1 || ll > length || pp[ll - 1] != '\n')
index b765e5b..81790a8 100644 (file)
@@ -224,11 +224,6 @@ static struct stateswitch stateswitches[] = {
   { NUMSTATES}
 };
 
-/* maxmum initial size of
-   the checksum cache */
-#define MAX_CSCACHE 32768
-#define CSREALLOC_STEP 1024
-
 struct parsedata {
   int ret;
   Pool *pool;