The following commit has been merged in the master branch:
commit 2449dcaa610b86221d914140a7e747728f5cc409
Author: Guillem Jover <[email protected]>
Date:   Sat Feb 19 06:08:13 2011 +0100

    dpkg: Move varbuf related calls close together in setselections()
    
    It's easier to read if the varbuf calls affecting the same variable are
    close together, rather than dispersed around in the code.

diff --git a/src/select.c b/src/select.c
index f1a789d..a23e2ff 100644
--- a/src/select.c
+++ b/src/select.c
@@ -95,36 +95,40 @@ void setselections(const char *const *argv) {
 
   lno= 1;
   for (;;) {
-    varbuf_reset(&namevb);
-    varbuf_reset(&selvb);
     do { c= getchar(); if (c == '\n') lno++; } while (c != EOF && isspace(c));
     if (c == EOF) break;
     if (c == '#') {
       do { c= getchar(); if (c == '\n') lno++; } while (c != EOF && c != '\n');
       continue;
     }
+
+    varbuf_reset(&namevb);
     while (!isspace(c)) {
       varbuf_add_char(&namevb, c);
       c= getchar();
       if (c == EOF) ohshit(_("unexpected eof in package name at line %d"),lno);
       if (c == '\n') ohshit(_("unexpected end of line in package name at line 
%d"),lno);
     }
+    varbuf_add_char(&namevb, '\0');
+
     while (c != EOF && isspace(c)) {
       c= getchar();
       if (c == EOF) ohshit(_("unexpected eof after package name at line 
%d"),lno);
       if (c == '\n') ohshit(_("unexpected end of line after package name at 
line %d"),lno);
     }
+
+    varbuf_reset(&selvb);
     while (c != EOF && !isspace(c)) {
       varbuf_add_char(&selvb, c);
       c= getchar();
     }
+    varbuf_add_char(&selvb, '\0');
+
     while (c != EOF && c != '\n') {
       c= getchar();
       if (!isspace(c))
         ohshit(_("unexpected data after package and selection at line 
%d"),lno);
     }
-    varbuf_add_char(&namevb, '\0');
-    varbuf_add_char(&selvb, '\0');
     e = pkg_name_is_illegal(namevb.buf, NULL);
     if (e) ohshit(_("illegal package name at line %d: %.250s"),lno,e);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to