Re: [patch] opencvs rcsnum_free()

2016-10-13 Thread Frederic Cambus
On Fri, Jun 24, 2016 at 11:22:06AM +0200, Joris Vink wrote:
> On Fri, Jun 24, 2016 at 01:58:20PM +0800, Michael W. Bombardieri wrote:

> > If people are interested in opencvs diffs again, sharing a 
> > rcsnum_free()->free()
> > clean-up item. Note that rcs(1) also has a version of rcsnum_free() which 
> > does more
> > than simply call free().
> 
> This is good. Eventually the rcs(1) rcsnum code should get the same
> simplification as opencvs got regarding how it deals with rn_id as well.

Looks good to me, with a caveat though: there is a missing include on
stdlib.h in getlog.c, which breaks compilation.

With the missing include this is OK fcambus@ if anyone wants to commit.



[patch] opencvs rcsnum_free()

2016-06-24 Thread Michael W. Bombardieri
Hi,

If people are interested in opencvs diffs again, sharing a rcsnum_free()->free()
clean-up item. Note that rcs(1) also has a version of rcsnum_free() which does 
more
than simply call free().

- Michael


Index: add.c
===
RCS file: /cvs/src/usr.bin/cvs/add.c,v
retrieving revision 1.112
diff -u -p -u -r1.112 add.c
--- add.c   5 Nov 2015 09:48:21 -   1.112
+++ add.c   24 Jun 2016 06:10:45 -
@@ -485,8 +485,7 @@ add_file(struct cvs_file *cf)
break;
}
 
-   if (head != NULL)
-   rcsnum_free(head);
+   free(head);
 
if (stop == 1)
return;
Index: admin.c
===
RCS file: /cvs/src/usr.bin/cvs/admin.c,v
retrieving revision 1.66
diff -u -p -u -r1.66 admin.c
--- admin.c 5 Nov 2015 09:48:21 -   1.66
+++ admin.c 24 Jun 2016 06:10:45 -
@@ -334,11 +334,11 @@ cvs_admin_local(struct cvs_file *cf)
if (rcs_rev_setlog(cf->file_rcs, rev, logmsg) < 0) {
cvs_log(LP_ERR, "failed to set logmsg for `%s' to `%s'",
logstr, logmsg);
-   rcsnum_free(rev);
+   free(rev);
return;
}
 
-   rcsnum_free(rev);
+   free(rev);
}
 
if (orange != NULL) {
@@ -380,7 +380,7 @@ cvs_admin_local(struct cvs_file *cf)
 
(void)rcs_state_set(cf->file_rcs, rev, state);
 
-   rcsnum_free(rev);
+   free(rev);
}
 
if (lkmode != RCS_LOCK_INVAL)
Index: annotate.c
===
RCS file: /cvs/src/usr.bin/cvs/annotate.c,v
retrieving revision 1.65
diff -u -p -u -r1.65 annotate.c
--- annotate.c  5 Nov 2015 09:48:21 -   1.65
+++ annotate.c  24 Jun 2016 06:10:45 -
@@ -178,7 +178,7 @@ cvs_annotate_local(struct cvs_file *cf)
rev = rcsnum_parse(cvs_specified_tag);
if (rev == NULL)
fatal("no such tag %s", cvs_specified_tag);
-rcsnum_free(rev);
+free(rev);
rev = rcsnum_alloc();
rcsnum_cpy(cf->file_rcs->rf_head, rev, 0);
}
@@ -205,9 +205,9 @@ cvs_annotate_local(struct cvs_file *cf)
 */
if (bnum != rev) {
rcs_annotate_getlines(cf->file_rcs, rev, );
-   rcsnum_free(bnum);
+   free(bnum);
}
-   rcsnum_free(rev);
+   free(rev);
} else {
rcs_rev_getlines(cf->file_rcs, (cvs_specified_date != -1 ||
cvs_directory_date != -1) ? cf->file_rcsrev :
Index: commit.c
===
RCS file: /cvs/src/usr.bin/cvs/commit.c,v
retrieving revision 1.154
diff -u -p -u -r1.154 commit.c
--- commit.c5 Nov 2015 09:48:21 -   1.154
+++ commit.c24 Jun 2016 06:10:45 -
@@ -365,7 +365,7 @@ cvs_commit_check_files(struct cvs_file *
if (brev != NULL) {
if (RCSNUM_ISBRANCH(brev))
goto next;
-   rcsnum_free(brev);
+   free(brev);
}
 
brev = rcs_translate_tag(tag, cf->file_rcs);
@@ -382,7 +382,7 @@ cvs_commit_check_files(struct cvs_file *
"a branch for file %s", tag,
cf->file_path);
conflicts_found++;
-   rcsnum_free(brev);
+   free(brev);
return;
}
 
@@ -391,8 +391,8 @@ cvs_commit_check_files(struct cvs_file *
"a branch for file %s", tag,
cf->file_path);
conflicts_found++;
-   rcsnum_free(branch);
-   rcsnum_free(brev);
+   free(branch);
+   free(brev);
return;
}
 
@@ -401,18 +401,16 @@ cvs_commit_check_files(struct cvs_file *
"a branch for file %s", tag,
cf->file_path);
conflicts_found++;
-   rcsnum_free(branch);
-   rcsnum_free(brev);
+   free(branch);
+   free(brev);
return;
}