]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Improve C89 compliance
authorIngo Weinhold <ingo_weinhold@gmx.de>
Sat, 30 Mar 2013 11:12:31 +0000 (11:12 +0000)
committerIngo Weinhold <ingo_weinhold@gmx.de>
Sat, 30 Mar 2013 15:51:21 +0000 (15:51 +0000)
Make sure variables are declared at the beginning of a block.

examples/solv.c
ext/solv_xfopen.c
src/solver.c

index 7d3b0684bc48de71b31d21091773a5f111b59ae1..6bfacea0f0d9c23fb042d5223f6876658f41700f 100644 (file)
@@ -797,8 +797,9 @@ curlfopen(struct repoinfo *cinfo, const char *file, int uncompress, const unsign
       if (file != cinfo->metalink && file != cinfo->mirrorlist)
        {
          unsigned char mlchksum[32];
+         Id mlchksumtype;
          fp = curlfopen(cinfo, cinfo->metalink ? cinfo->metalink : cinfo->mirrorlist, 0, 0, 0, 0);
-         Id mlchksumtype = 0;
+         mlchksumtype = 0;
          if (!fp)
            return 0;
          if (cinfo->metalink)
@@ -3169,10 +3170,11 @@ rerunsolver:
       Solvable *s;
       int j;
       FILE *fp;
+      Id type;
 
       p = trans->steps.elements[i];
       s = pool_id2solvable(pool, p);
-      Id type = transaction_type(trans, p, SOLVER_TRANSACTION_RPM_ONLY);
+      type = transaction_type(trans, p, SOLVER_TRANSACTION_RPM_ONLY);
       switch(type)
        {
        case SOLVER_TRANSACTION_ERASE:
index 6c6441c2f49f45ce921e82b2e5afb5deb75d0641..337b0150b2aa3a17939a9c48ced7f29c10380d99 100644 (file)
@@ -32,14 +32,16 @@ static FILE *cookieopen(void *cookie, const char *mode,
       cclose
       );
 #elif defined(HAVE_FOPENCOOKIE)
-  cookie_io_functions_t cio;
-  memset(&cio, 0, sizeof(cio));
-  if (*mode == 'r')
-    cio.read = cread;
-  else if (*mode == 'w')
-    cio.write = cwrite;
-  cio.close = cclose;
-  return  fopencookie(cookie, *mode == 'w' ? "w" : "r", cio);
+  {
+    cookie_io_functions_t cio;
+    memset(&cio, 0, sizeof(cio));
+    if (*mode == 'r')
+      cio.read = cread;
+    else if (*mode == 'w')
+      cio.write = cwrite;
+    cio.close = cclose;
+    return  fopencookie(cookie, *mode == 'w' ? "w" : "r", cio);
+  }
 #else
 # error Need to implement custom I/O
 #endif
index e4c333c605984519bcc478d16b24942b19f636d6..64b8376ee38155a52f4dc464c2b9fcb1289c7bcf 100644 (file)
@@ -182,9 +182,10 @@ autouninstall(Solver *solv, Id *problem)
        {
          /* check if identical to feature rule */
          Id p = solv->rules[v].p;
+         Rule *r;
          if (p <= 0)
            continue;
-         Rule *r = solv->rules + solv->featurerules + (p - solv->installed->start);
+         r = solv->rules + solv->featurerules + (p - solv->installed->start);
          if (!r->p)
            {
              /* update rule == feature rule */