[BACK]Return to file.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Diff for /src/usr.bin/cvs/file.c between version 1.9 and 1.10

version 1.9, 2004/07/29 15:41:57 version 1.10, 2004/07/29 16:59:39
Line 121 
Line 121 
         rcsnum_aton("0", NULL, cvs_addedrev);          rcsnum_aton("0", NULL, cvs_addedrev);
   
         /* standard patterns to ignore */          /* standard patterns to ignore */
         for (i = 0; i < sizeof(cvs_ign_std)/sizeof(char *); i++)          for (i = 0; i < (int)(sizeof(cvs_ign_std)/sizeof(char *)); i++)
                 cvs_file_ignore(cvs_ign_std[i]);                  cvs_file_ignore(cvs_ign_std[i]);
   
         /* read the cvsignore file in the user's home directory, if any */          /* read the cvsignore file in the user's home directory, if any */
Line 413 
Line 413 
         struct dirent *ent;          struct dirent *ent;
         struct cvs_file *cfp;          struct cvs_file *cfp;
         struct cvs_dir *cdp;          struct cvs_dir *cdp;
           struct cvs_flist dirs;
   
           TAILQ_INIT(&dirs);
         cdp = cf->cf_ddat;          cdp = cf->cf_ddat;
   
         if (cvs_readrepo(cf->cf_path, pbuf, sizeof(pbuf)) == 0) {          if (cvs_readrepo(cf->cf_path, pbuf, sizeof(pbuf)) == 0) {
Line 457 
Line 459 
                 cfp = cvs_file_get(pbuf, flags);                  cfp = cvs_file_get(pbuf, flags);
                 if (cfp != NULL) {                  if (cfp != NULL) {
                         cfp->cf_parent = cf;                          cfp->cf_parent = cf;
                         LIST_INSERT_HEAD(&(cdp->cd_files), cfp, cf_list);  
                           if (cfp->cf_type == DT_DIR)
                                   TAILQ_INSERT_HEAD(&dirs, cfp, cf_list);
                           else
                                   TAILQ_INSERT_HEAD(&(cdp->cd_files), cfp,
                                       cf_list);
                 }                  }
         }          }
   
         if (flags & CF_SORT)          if (flags & CF_SORT) {
                 cvs_file_sort(&(cdp->cd_files));                  cvs_file_sort(&(cdp->cd_files));
                   cvs_file_sort(&dirs);
           }
           TAILQ_FOREACH(cfp, &dirs, cf_list)
                   TAILQ_INSERT_TAIL(&(cdp->cd_files), cfp, cf_list);
   
         (void)close(fd);          (void)close(fd);
         cf->cf_ddat = cdp;          cf->cf_ddat = cdp;
Line 480 
Line 491 
 void  void
 cvs_file_free(struct cvs_file *cf)  cvs_file_free(struct cvs_file *cf)
 {  {
         struct cvs_file *cfp;  
         struct cvs_dir *cd;  
   
         if (cf->cf_path != NULL)          if (cf->cf_path != NULL)
                 free(cf->cf_path);                  free(cf->cf_path);
         if (cf->cf_stat != NULL)          if (cf->cf_stat != NULL)
Line 509 
Line 517 
   
         if (cf->cf_type == DT_DIR) {          if (cf->cf_type == DT_DIR) {
                 ret = (*exam)(cf, arg);                  ret = (*exam)(cf, arg);
                 LIST_FOREACH(fp, &(cf->cf_ddat->cd_files), cf_list) {                  TAILQ_FOREACH(fp, &(cf->cf_ddat->cd_files), cf_list) {
                         ret = cvs_file_examine(fp, exam, arg);                          ret = cvs_file_examine(fp, exam, arg);
                         if (ret == -1)                          if (ret == -1)
                                 return (-1);                                  return (-1);
Line 536 
Line 544 
         if (cd->cd_repo != NULL)          if (cd->cd_repo != NULL)
                 free(cd->cd_repo);                  free(cd->cd_repo);
   
         while (!LIST_EMPTY(&(cd->cd_files))) {          while (!TAILQ_EMPTY(&(cd->cd_files))) {
                 cfp = LIST_FIRST(&(cd->cd_files));                  cfp = TAILQ_FIRST(&(cd->cd_files));
                 LIST_REMOVE(cfp, cf_list);                  TAILQ_REMOVE(&(cd->cd_files), cfp, cf_list);
                 cvs_file_free(cfp);                  cvs_file_free(cfp);
         }          }
 }  }
Line 558 
Line 566 
         struct cvs_file *cf, *cfvec[256];          struct cvs_file *cf, *cfvec[256];
   
         i = 0;          i = 0;
         LIST_FOREACH(cf, flp, cf_list) {          TAILQ_FOREACH(cf, flp, cf_list) {
                 cfvec[i++] = cf;                  cfvec[i++] = cf;
                 if (i == sizeof(cfvec)/sizeof(struct cvs_file *)) {                  if (i == sizeof(cfvec)/sizeof(struct cvs_file *)) {
                         cvs_log(LP_WARN, "too many files to sort");                          cvs_log(LP_WARN, "too many files to sort");
Line 568 
Line 576 
                 /* now unlink it from the list,                  /* now unlink it from the list,
                  * we'll put it back in order later                   * we'll put it back in order later
                  */                   */
                 LIST_REMOVE(cf, cf_list);                  TAILQ_REMOVE(flp, cf, cf_list);
         }          }
   
         /* clear the list just in case */          /* clear the list just in case */
         LIST_INIT(flp);          TAILQ_INIT(flp);
         nb = (size_t)i;          nb = (size_t)i;
   
         heapsort(cfvec, nb, sizeof(cf), cvs_file_cmp);          heapsort(cfvec, nb, sizeof(cf), cvs_file_cmp);
   
         /* rebuild the list from the bottom up */          /* rebuild the list from the bottom up */
         for (i = (int)nb - 1; i >= 0; i--)          for (i = (int)nb - 1; i >= 0; i--)
                 LIST_INSERT_HEAD(flp, cfvec[i], cf_list);                  TAILQ_INSERT_HEAD(flp, cfvec[i], cf_list);
   
         return (0);          return (0);
 }  }
Line 638 
Line 646 
                         return (NULL);                          return (NULL);
                 }                  }
                 memset(ddat, 0, sizeof(*ddat));                  memset(ddat, 0, sizeof(*ddat));
                 LIST_INIT(&(ddat->cd_files));                  TAILQ_INIT(&(ddat->cd_files));
                 cfp->cf_ddat = ddat;                  cfp->cf_ddat = ddat;
         }          }
         return (cfp);          return (cfp);

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10