Adam Heath пре 25 година
родитељ
комит
037db2c355
6 измењених фајлова са 37 додато и 33 уклоњено
  1. 4 0
      ChangeLog
  2. 3 3
      split/info.c
  3. 1 1
      split/join.c
  4. 23 23
      split/main.c
  5. 5 5
      split/queue.c
  6. 1 1
      split/split.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+Thu Apr 26 11:51:34 CDT 2001 Adam Heath <doogie@debian.org>
+
+  * split/{info,join,main,queue,split}.c: s/0/NULL/
+
 Thu Apr 26 13:36:41 CEST 2001 Wichert Akkerman <wakkerma@debian.org>
 
   * utils/md5sum.c: use libdpkg error handling since fd_md5 uses that

+ 3 - 3
split/info.c

@@ -73,7 +73,7 @@ static char *nextline(char **ripp, const char *fn, const char *what) {
 
 struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir) {
   /* returns info (nfmalloc'd) if was an archive part and we read it, 0 if it wasn't */
-  static char *readinfobuf= 0;
+  static char *readinfobuf= NULL;
   static size_t readinfobuflen= 0;
 
   size_t thisilen;
@@ -84,9 +84,9 @@ struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir)
   struct stat stab;
   
   if (fread(magicbuf,1,sizeof(PARTMAGIC)-1,partfile) != sizeof(PARTMAGIC)-1) {
-    if (ferror(partfile)) rerr(fn); else return 0;
+    if (ferror(partfile)) rerr(fn); else return NULL;
   }
-  if (memcmp(magicbuf,PARTMAGIC,sizeof(magicbuf))) return 0;
+  if (memcmp(magicbuf,PARTMAGIC,sizeof(magicbuf))) return NULL;
   if (fseek(partfile,-sizeof(arh.ar_name),SEEK_CUR))
     ohshite(_("unable to seek back"));
   

+ 1 - 1
split/join.c

@@ -109,7 +109,7 @@ void do_join(const char *const *argv) {
     pq->nextinqueue= queue;
     queue= pq;
   }
-  refi= 0;
+  refi= NULL;
   for (pq= queue; pq; pq= pq->nextinqueue)
     if (!refi || pq->info.thispartn < refi->thispartn) refi= &pq->info;
   assert(refi);

+ 23 - 23
split/main.c

@@ -67,11 +67,11 @@ Exit status: 0 = OK;  1 = -a is not a part;  2 = trouble!\n"),
 const char thisname[]= SPLITTER;
 const char printforhelp[]= N_("Type dpkg-split --help for help.");
 
-dofunction *action=0;
-const struct cmdinfo *cipaction=0;
+dofunction *action=NULL;
+const struct cmdinfo *cipaction=NULL;
 long maxpartsize= SPLITPARTDEFMAX;
-const char *depotdir= ADMINDIR "/" PARTSDIR, *outputfile= 0;
-struct partqueue *queue= 0;
+const char *depotdir= ADMINDIR "/" PARTSDIR, *outputfile= NULL;
+struct partqueue *queue= NULL;
 int npquiet= 0, msdos= 0;
 
 void rerr(const char *fn) {
@@ -121,22 +121,22 @@ static dofunction *const dofunctions[]= {
  * same order as dofunctions:
  */
 static const struct cmdinfo cmdinfos[]= {
-  { "split",        's',  0,  0, 0,             setaction           },
-  { "join",         'j',  0,  0, 0,             setaction           },
-  { "info",         'I',  0,  0, 0,             setaction           },
-  { "auto",         'a',  0,  0, 0,             setaction           },
-  { "listq",        'l',  0,  0, 0,             setaction           },
-  { "discard",      'd',  0,  0, 0,             setaction           },
-  { "help",         'h',  0,  0, 0,             helponly            },
-  { "version",       0,   0,  0, 0,             versiononly         },
-  { "licence",       0,   0,  0, 0,             showcopyright       }, /* UK spelling */
-  { "license",       0,   0,  0, 0,             showcopyright       }, /* US spelling */
-  { "depotdir",      0,   1,  0, &depotdir,     0                   },
-  { "partsize",     'S',  1,  0, 0,             setpartsize         },
-  { "output",       'o',  1,  0, &outputfile,   0                   },
-  { "npquiet",      'Q',  0,  &npquiet, 0,      0,              1   },
-  { "msdos",         0,   0,  &msdos, 0,        0,              1   },
-  {  0,              0                                              }
+  { "split",        's',  0,  NULL, NULL,             setaction           },
+  { "join",         'j',  0,  NULL, NULL,             setaction           },
+  { "info",         'I',  0,  NULL, NULL,             setaction           },
+  { "auto",         'a',  0,  NULL, NULL,             setaction           },
+  { "listq",        'l',  0,  NULL, NULL,             setaction           },
+  { "discard",      'd',  0,  NULL, NULL,             setaction           },
+  { "help",         'h',  0,  NULL, NULL,             helponly            },
+  { "version",       0,   0,  NULL, NULL,             versiononly         },
+  { "licence",       0,   0,  NULL, NULL,             showcopyright       }, /* UK spelling */
+  { "license",       0,   0,  NULL, NULL,             showcopyright       }, /* US spelling */
+  { "depotdir",      0,   1,  NULL, &depotdir,     NULL                   },
+  { "partsize",     'S',  1,  NULL, NULL,             setpartsize         },
+  { "output",       'o',  1,  NULL, &outputfile,   NULL                   },
+  { "npquiet",      'Q',  0,  &npquiet, NULL,      NULL,              1   },
+  { "msdos",         0,   0,  &msdos, NULL,        NULL,              1   },
+  {  NULL,              0                                              }
 };
 
 static void setaction(const struct cmdinfo *cip, const char *value) {
@@ -160,7 +160,7 @@ int main(int argc, const char *const *argv) {
   if (setjmp(ejbuf)) { /* expect warning about possible clobbering of argv */
     error_unwind(ehflag_bombout); exit(2);
   }
-  push_error_handler(&ejbuf,print_error_fatal,0);
+  push_error_handler(&ejbuf,print_error_fatal,NULL);
 
   myopt(&argv,cmdinfos);
   if (!cipaction) badusage(_("need an action option"));
@@ -173,12 +173,12 @@ int main(int argc, const char *const *argv) {
     depotdir= p;
   }
 
-  setvbuf(stdout,0,_IONBF,0);
+  setvbuf(stdout,NULL,_IONBF,0);
   action(argv);
 
   if (ferror(stderr)) werr("stderr");
   
-  set_error_display(0,0);
+  set_error_display(NULL,NULL);
   error_unwind(ehflag_normaltidy);
   exit(0);
 }

+ 5 - 5
split/queue.c

@@ -70,7 +70,7 @@ void scandepot(void) {
   while ((de= readdir(depot))) {
     if (de->d_name[0] == '.') continue;
     pq= nfmalloc(sizeof(struct partqueue));
-    pq->info.fmtversion= pq->info.package= pq->info.version= 0;
+    pq->info.fmtversion= pq->info.package= pq->info.version= NULL;
     pq->info.orglength= pq->info.thispartoffset= pq->info.thispartlen= 0;
     pq->info.headerlen= 0;
     p= nfmalloc(strlen(depotdir)+strlen(de->d_name)+1);
@@ -78,7 +78,7 @@ void scandepot(void) {
     strcat(p,de->d_name);
     pq->info.filename= p;
     if (!decompose_filename(de->d_name,pq)) {
-      pq->info.md5sum= 0;
+      pq->info.md5sum= NULL;
       pq->info.maxpartlen= pq->info.thispartn= pq->info.maxpartn= 0;
     }
     pq->nextinqueue= queue;
@@ -227,7 +227,7 @@ void do_queue(const char *const *argv) {
         if (!S_ISREG(stab.st_mode))
           ohshit(_("part file `%.250s' is not a plain file"),qq->info.filename);
         bytes+= stab.st_size;
-        qq->info.md5sum= 0; /* don't find this package again */
+        qq->info.md5sum= NULL; /* don't find this package again */
       }
     }
     printf(_("(total %lu bytes)\n"),bytes);
@@ -267,9 +267,9 @@ void do_discard(const char *const *argv) {
     for (pq= queue; pq; pq= pq->nextinqueue)
       if (pq->info.md5sum)
         mustgetpartinfo(pq->info.filename,&pq->info);
-    discardsome(ds_junk,0);
+    discardsome(ds_junk,NULL);
     while ((thisarg= *argv++)) discardsome(ds_package,thisarg);
   } else {
-    discardsome(ds_all,0);
+    discardsome(ds_all,NULL);
   }
 }

+ 1 - 1
split/split.c

@@ -67,6 +67,6 @@ void do_split(const char *const *argv) {
   m_dup2(fd,0);
   execl(MKSPLITSCRIPT,MKSPLITSCRIPT,
         sourcefile,partsizebuf,prefix,lengthbuf,partsizeallowbuf,msdos?"yes":"no",
-        (char*)0);
+        NULL);
   ohshite(_("unable to exec mksplit"));
 }