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

Diff for /src/usr.bin/cvs/rcs.c between version 1.110 and 1.111

version 1.110, 2005/12/10 20:27:45 version 1.111, 2005/12/12 17:47:03
Line 671 
Line 671 
         if ((rd = rcs_findrev(file, rev)) == NULL)          if ((rd = rcs_findrev(file, rev)) == NULL)
                 return (-1);                  return (-1);
   
         if ((file->rf_head == NULL) &&          if (file->rf_head == NULL)
             ((file->rf_head = rcsnum_alloc()) == NULL))                  file->rf_head = rcsnum_alloc();
                 return (-1);  
   
         if (rcsnum_cpy(rev, file->rf_head, 0) < 0)          rcsnum_cpy(rev, file->rf_head, 0);
                 return (-1);  
   
         file->rf_flags &= ~RCS_SYNCED;          file->rf_flags &= ~RCS_SYNCED;
         return (0);          return (0);
 }  }
Line 705 
Line 702 
 int  int
 rcs_branch_set(RCSFILE *file, const RCSNUM *bnum)  rcs_branch_set(RCSFILE *file, const RCSNUM *bnum)
 {  {
         if ((file->rf_branch == NULL) &&          if (file->rf_branch == NULL)
             ((file->rf_branch = rcsnum_alloc()) == NULL))                  file->rf_branch = rcsnum_alloc();
                 return (-1);  
   
         if (rcsnum_cpy(bnum, file->rf_branch, 0) < 0) {          rcsnum_cpy(bnum, file->rf_branch, 0);
                 rcsnum_free(file->rf_branch);  
                 file->rf_branch = NULL;  
                 return (-1);  
         }  
   
         file->rf_flags &= ~RCS_SYNCED;          file->rf_flags &= ~RCS_SYNCED;
         return (0);          return (0);
 }  }
Line 804 
Line 795 
   
         symp = (struct rcs_sym *)xmalloc(sizeof(*symp));          symp = (struct rcs_sym *)xmalloc(sizeof(*symp));
         symp->rs_name = xstrdup(sym);          symp->rs_name = xstrdup(sym);
         if ((symp->rs_num = rcsnum_alloc()) == NULL) {          symp->rs_num = rcsnum_alloc();
                 xfree(symp->rs_name);  
                 xfree(symp);  
                 return (-1);  
         }  
         rcsnum_cpy(snum, symp->rs_num, 0);          rcsnum_cpy(snum, symp->rs_num, 0);
   
         TAILQ_INSERT_HEAD(&(rfp->rf_symbols), symp, rs_list);          TAILQ_INSERT_HEAD(&(rfp->rf_symbols), symp, rs_list);
Line 879 
Line 866 
                 if (strcmp(symp->rs_name, sym) == 0)                  if (strcmp(symp->rs_name, sym) == 0)
                         break;                          break;
   
         if (symp == NULL)          if (symp == NULL) {
                 rcs_errno = RCS_ERR_NOENT;                  rcs_errno = RCS_ERR_NOENT;
         else if (((num = rcsnum_alloc()) != NULL) &&          } else {
             (rcsnum_cpy(symp->rs_num, num, 0) < 0)) {                  num = rcsnum_alloc();
                 rcsnum_free(num);                  rcsnum_cpy(symp->rs_num, num, 0);
                 num = NULL;  
         }          }
   
         return (num);          return (num);
Line 975 
Line 961 
   
         lkp = (struct rcs_lock *)xmalloc(sizeof(*lkp));          lkp = (struct rcs_lock *)xmalloc(sizeof(*lkp));
         lkp->rl_name = xstrdup(user);          lkp->rl_name = xstrdup(user);
         if ((lkp->rl_num = rcsnum_alloc()) == NULL) {          lkp->rl_num = rcsnum_alloc();
                 xfree(lkp->rl_name);  
                 xfree(lkp);  
                 return (-1);  
         }  
         rcsnum_cpy(rev, lkp->rl_num, 0);          rcsnum_cpy(rev, lkp->rl_num, 0);
   
         TAILQ_INSERT_TAIL(&(file->rf_locks), lkp, rl_list);          TAILQ_INSERT_TAIL(&(file->rf_locks), lkp, rl_list);
Line 1351 
Line 1333 
         struct rcs_delta *ordp, *rdp;          struct rcs_delta *ordp, *rdp;
         RCSNUM *old;          RCSNUM *old;
   
         if ((old = rcsnum_alloc()) == NULL)          old = rcsnum_alloc();
                 return (-1);  
   
         if (rev == RCS_HEAD_REV) {          if (rev == RCS_HEAD_REV) {
                 if (rf->rf_flags & RCS_CREATE) {                  if (rf->rf_flags & RCS_CREATE) {
                         if ((rev = rcsnum_parse(RCS_HEAD_INIT)) == NULL)                          if ((rev = rcsnum_parse(RCS_HEAD_INIT)) == NULL)
                                 return (-1);                                  return (-1);
                         if ((rf->rf_head = rcsnum_alloc()) == NULL) {                          rf->rf_head = rcsnum_alloc();
                                 rcsnum_free(rev);  
                                 return (-1);  
                         }  
                         rcsnum_cpy(rev, rf->rf_head, 0);                          rcsnum_cpy(rev, rf->rf_head, 0);
                 } else {                  } else {
                         rcsnum_cpy(rf->rf_head, old, 0);                          rcsnum_cpy(rf->rf_head, old, 0);
Line 1396 
Line 1373 
         TAILQ_INIT(&(rdp->rd_branches));          TAILQ_INIT(&(rdp->rd_branches));
         TAILQ_INIT(&(rdp->rd_snodes));          TAILQ_INIT(&(rdp->rd_snodes));
   
         if ((rdp->rd_num = rcsnum_alloc()) == NULL) {          rdp->rd_num = rcsnum_alloc();
                 rcs_freedelta(rdp);  
                 rcsnum_free(old);  
                 return (-1);  
         }  
         rcsnum_cpy(rev, rdp->rd_num, 0);          rcsnum_cpy(rev, rdp->rd_num, 0);
   
         if ((rdp->rd_next = rcsnum_alloc()) == NULL) {          rdp->rd_next = rcsnum_alloc();
                 rcs_freedelta(rdp);  
                 rcsnum_free(old);  
                 return (-1);  
         }  
   
         if (!(rf->rf_flags & RCS_CREATE))          if (!(rf->rf_flags & RCS_CREATE))
                 rcsnum_cpy(old, rdp->rd_next, 0);                  rcsnum_cpy(old, rdp->rd_next, 0);
Line 1771 
Line 1740 
                         }                          }
   
                         if (tok == RCS_TOK_HEAD) {                          if (tok == RCS_TOK_HEAD) {
                                 if (rfp->rf_head == NULL) {                                  if (rfp->rf_head == NULL)
                                         rfp->rf_head = rcsnum_alloc();                                          rfp->rf_head = rcsnum_alloc();
                                         if (rfp->rf_head == NULL)  
                                                 return (-1);  
                                 }  
                                 rcsnum_aton(RCS_TOKSTR(rfp), NULL,                                  rcsnum_aton(RCS_TOKSTR(rfp), NULL,
                                     rfp->rf_head);                                      rfp->rf_head);
                         } else if (tok == RCS_TOK_BRANCH) {                          } else if (tok == RCS_TOK_BRANCH) {
                                 if (rfp->rf_branch == NULL) {                                  if (rfp->rf_branch == NULL)
                                         rfp->rf_branch = rcsnum_alloc();                                          rfp->rf_branch = rcsnum_alloc();
                                         if (rfp->rf_branch == NULL)  
                                                 return (-1);  
                                 }  
                                 if (rcsnum_aton(RCS_TOKSTR(rfp), NULL,                                  if (rcsnum_aton(RCS_TOKSTR(rfp), NULL,
                                     rfp->rf_branch) < 0)                                      rfp->rf_branch) < 0)
                                         return (-1);                                          return (-1);
Line 1849 
Line 1812 
         memset(rdp, 0, sizeof(*rdp));          memset(rdp, 0, sizeof(*rdp));
   
         rdp->rd_num = rcsnum_alloc();          rdp->rd_num = rcsnum_alloc();
         if (rdp->rd_num == NULL) {  
                 rcs_freedelta(rdp);  
                 return (-1);  
         }  
         rdp->rd_next = rcsnum_alloc();          rdp->rd_next = rcsnum_alloc();
         if (rdp->rd_next == NULL) {  
                 rcs_freedelta(rdp);  
                 return (-1);  
         }  
   
         TAILQ_INIT(&(rdp->rd_branches));          TAILQ_INIT(&(rdp->rd_branches));
         TAILQ_INIT(&(rdp->rd_snodes));          TAILQ_INIT(&(rdp->rd_snodes));
Line 2035 
Line 1990 
         }          }
   
         tnum = rcsnum_alloc();          tnum = rcsnum_alloc();
         if (tnum == NULL)  
                 return (-1);  
         rcsnum_aton(RCS_TOKSTR(rfp), NULL, tnum);          rcsnum_aton(RCS_TOKSTR(rfp), NULL, tnum);
   
         TAILQ_FOREACH(rdp, &(rfp->rf_delta), rd_list) {          TAILQ_FOREACH(rdp, &(rfp->rf_delta), rd_list) {
Line 2143 
Line 2096 
                 symp = (struct rcs_sym *)xmalloc(sizeof(*symp));                  symp = (struct rcs_sym *)xmalloc(sizeof(*symp));
                 symp->rs_name = xstrdup(RCS_TOKSTR(rfp));                  symp->rs_name = xstrdup(RCS_TOKSTR(rfp));
                 symp->rs_num = rcsnum_alloc();                  symp->rs_num = rcsnum_alloc();
                 if (symp->rs_num == NULL) {  
                         cvs_log(LP_ERRNO, "failed to allocate rcsnum info");  
                         xfree(symp->rs_name);  
                         xfree(symp);  
                         return (-1);  
                 }  
   
                 type = rcs_gettok(rfp);                  type = rcs_gettok(rfp);
                 if (type != RCS_TOK_COLON) {                  if (type != RCS_TOK_COLON) {
Line 2214 
Line 2161 
                 lkp = (struct rcs_lock *)xmalloc(sizeof(*lkp));                  lkp = (struct rcs_lock *)xmalloc(sizeof(*lkp));
                 lkp->rl_name = xstrdup(RCS_TOKSTR(rfp));                  lkp->rl_name = xstrdup(RCS_TOKSTR(rfp));
                 lkp->rl_num = rcsnum_alloc();                  lkp->rl_num = rcsnum_alloc();
                 if (lkp->rl_num == NULL) {  
                         xfree(lkp->rl_name);  
                         xfree(lkp);  
                         return (-1);  
                 }  
   
                 type = rcs_gettok(rfp);                  type = rcs_gettok(rfp);
                 if (type != RCS_TOK_COLON) {                  if (type != RCS_TOK_COLON) {
Line 2948 
Line 2890 
         }          }
   
         if (type == CHECKOUT_REV_MERGED) {          if (type == CHECKOUT_REV_MERGED) {
                 if ((oldrev = rcsnum_alloc()) == NULL)                  oldrev = rcsnum_alloc();
                         goto out;                  rcsnum_cpy(rev, oldrev, 0);
   
                 if (rcsnum_cpy(rev, oldrev, 0) < 0)  
                         goto out;  
   
                 if (rcsnum_dec(oldrev) == NULL)                  if (rcsnum_dec(oldrev) == NULL)
                         goto out;                          goto out;

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.111