Просмотр исходного кода

Use arglist instead of narglist

Guillem Jover лет назад: 18
Родитель
Сommit
30137f1113
2 измененных файлов с 16 добавлено и 13 удалено
  1. 4 0
      ChangeLog
  2. 12 13
      src/archives.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+2008-01-07  Guillem Jover  <guillem@debian.org>
+
+	* src/archives.c (archivefiles): Use arglist instead of narglist.
+
 2008-01-07  Guillem Jover  <guillem@debian.org>
 
 	* lib/nfmalloc.c (nfmalloc): Remove inline keyword as extern inline

+ 12 - 13
src/archives.c

@@ -1092,34 +1092,33 @@ void archivefiles(const char *const *argv) {
     m_pipe(pi);
     if (!(fc= m_fork())) {
       const char *const *ap;
-      char **narglist;
       int i;
       m_dup2(pi[1],1); close(pi[0]); close(pi[1]);
       for (i=0, ap=argv; *ap; ap++, i++);
-      narglist= m_malloc(sizeof(char*)*(i+15));
-      narglist[0] = FIND;
+      arglist = m_malloc(sizeof(char *) * (i + 15));
+      arglist[0] = FIND;
       for (i=1, ap=argv; *ap; ap++, i++) {
         if (strchr(FIND_EXPRSTARTCHARS,(*ap)[0])) {
           char *a;
           a= m_malloc(strlen(*ap)+10);
           strcpy(a,"./");
           strcat(a,*ap);
-          narglist[i]= a;
+          arglist[i] = a;
         } else {
-          narglist[i] = (char *)*ap;
+          arglist[i] = (const char *)*ap;
         }
       }
       /* When editing these, make sure that arglist is malloced big enough,
        * above.
        */
-      narglist[i++] = "-follow";
-      narglist[i++] = "-name";
-      narglist[i++] = ARCHIVE_FILENAME_PATTERN;
-      narglist[i++] = "-type";
-      narglist[i++] = "f";
-      narglist[i++] = "-print0";
-      narglist[i++]= 0;
-      execvp(FIND, narglist);
+      arglist[i++] = "-follow";
+      arglist[i++] = "-name";
+      arglist[i++] = ARCHIVE_FILENAME_PATTERN;
+      arglist[i++] = "-type";
+      arglist[i++] = "f";
+      arglist[i++] = "-print0";
+      arglist[i++] = 0;
+      execvp(FIND, (char *const *)arglist);
       ohshite(_("failed to exec find for --recursive"));
     }
     close(pi[1]);