Re: [patch]rcs: remove xfree

2015-06-13 Thread Fritjof Bornebusch
On Sat, Jun 13, 2015 at 09:33:59AM +0100, Nicholas Marriott wrote:
 Hi. You missed date.y:
 
 date.y: In function 'yyerror':
 date.y:497: error: implicit declaration of function 'xfree'
 

Ups, sorry.
That should do the trick.

 
 On Sat, Jun 13, 2015 at 12:43:29AM +0200, Fritjof Bornebusch wrote:
   Hi tech@,
   
  
  Without PGP / SMIME stuff, sorry.
   
   a couple of months ago I removed the if condition in the *xfree* 
   function, but tedu@ suggested
   that it would be better to remove the *xfree* function entirely instead.
   
   If've seen there are *efree* functions in some tools, that just wrappes 
   the free(3) function call.
   I'm not quite sure what is the best way todo it, so comments are very 
   welcome.

   Regards,
   --F.
  
 
Index: buf.c
===
RCS file: /cvs/src/usr.bin/rcs/buf.c,v
retrieving revision 1.24
diff -u -p -r1.24 buf.c
--- buf.c   5 Feb 2015 12:59:58 -   1.24
+++ buf.c   12 Jun 2015 22:20:32 -
@@ -32,6 +32,7 @@
 #include fcntl.h
 #include stdint.h
 #include stdio.h
+#include stdlib.h
 #include string.h
 #include unistd.h
 
@@ -137,15 +138,14 @@ out:
 void
 buf_free(BUF *b)
 {
-   if (b-cb_buf != NULL)
-   xfree(b-cb_buf);
-   xfree(b);
+   free(b-cb_buf);
+   free(b);
 }
 
 /*
  * Free the buffer b's structural information but do not free the contents
  * of the buffer.  Instead, they are returned and should be freed later using
- * xfree().
+ * free().
  */
 void *
 buf_release(BUF *b)
@@ -153,7 +153,7 @@ buf_release(BUF *b)
void *tmp;
 
tmp = b-cb_buf;
-   xfree(b);
+   free(b);
return (tmp);
 }
 
Index: ci.c
===
RCS file: /cvs/src/usr.bin/rcs/ci.c,v
retrieving revision 1.219
diff -u -p -r1.219 ci.c
--- ci.c16 Jan 2015 06:40:11 -  1.219
+++ ci.c12 Jun 2015 22:20:32 -
@@ -211,7 +211,7 @@ checkin_main(int argc, char **argv)
exit(0);
case 'w':
if (pb.author != NULL)
-   xfree(pb.author);
+   free(pb.author);
pb.author = xstrdup(rcs_optarg);
break;
case 'x':
@@ -376,10 +376,8 @@ out:
buf_free(b2);
if (b3 != NULL)
buf_free(b3);
-   if (path1 != NULL)
-   xfree(path1);
-   if (path2 != NULL)
-   xfree(path2);
+   free(path1);
+   free(path2);
 
return (NULL);
 }
@@ -511,7 +509,7 @@ checkin_update(struct checkin_params *pb
fprintf(stderr,
reuse log message of previous file? [yn](y): );
if (rcs_yesno('y') != 'y') {
-   xfree(pb-rcs_msg);
+   free(pb-rcs_msg);
pb-rcs_msg = NULL;
}
}
@@ -584,7 +582,7 @@ checkin_update(struct checkin_params *pb
pb-username, pb-author, NULL, NULL);
 
if ((pb-flags  INTERACTIVE)  (pb-rcs_msg[0] == '\0')) {
-   xfree(pb-rcs_msg); /* free empty log message */
+   free(pb-rcs_msg);  /* free empty log message */
pb-rcs_msg = NULL;
}
 
@@ -988,25 +986,22 @@ checkin_parsekeyword(char *keystring, RC
(void)xasprintf(datestring, %s %s, tokens[3], tokens[4]);
if ((*date = date_parse(datestring)) == -1)
errx(1, could not parse date);
-   xfree(datestring);
+   free(datestring);
 
if (i  6)
break;
-   if (*author != NULL)
-   xfree(*author);
+   free(*author);
*author = xstrdup(tokens[5]);
 
if (i  7)
break;
-   if (*state != NULL)
-   xfree(*state);
+   free(*state);
*state = xstrdup(tokens[6]);
break;
case KW_TYPE_AUTHOR:
if (i  2)
break;
-   if (*author != NULL)
-   xfree(*author);
+   free(*author);
*author = xstrdup(tokens[1]);
break;
case KW_TYPE_DATE:
@@ -1015,13 +1010,12 @@ checkin_parsekeyword(char *keystring, RC
(void)xasprintf(datestring, %s %s, tokens[1], tokens[2]);
if ((*date = date_parse(datestring)) == -1)
errx(1, could not parse date);
-   xfree(datestring);
+   free(datestring);
break;
case KW_TYPE_STATE:
if (i  2)
break;
-   if (*state != NULL)
-   xfree(*state);
+   

Re: [patch]rcs: remove xfree

2015-06-13 Thread Nicholas Marriott
Hi. You missed date.y:

date.y: In function 'yyerror':
date.y:497: error: implicit declaration of function 'xfree'


On Sat, Jun 13, 2015 at 12:43:29AM +0200, Fritjof Bornebusch wrote:
  Hi tech@,
  
 
 Without PGP / SMIME stuff, sorry.
  
  a couple of months ago I removed the if condition in the *xfree* function, 
  but tedu@ suggested
  that it would be better to remove the *xfree* function entirely instead.
  
  If've seen there are *efree* functions in some tools, that just wrappes the 
  free(3) function call.
  I'm not quite sure what is the best way todo it, so comments are very 
  welcome.
   
  Regards,
  --F.
  
 Index: buf.c
 ===
 RCS file: /cvs/src/usr.bin/rcs/buf.c,v
 retrieving revision 1.24
 diff -u -p -r1.24 buf.c
 --- buf.c 5 Feb 2015 12:59:58 -   1.24
 +++ buf.c 12 Jun 2015 22:20:32 -
 @@ -32,6 +32,7 @@
  #include fcntl.h
  #include stdint.h
  #include stdio.h
 +#include stdlib.h
  #include string.h
  #include unistd.h
  
 @@ -137,15 +138,14 @@ out:
  void
  buf_free(BUF *b)
  {
 - if (b-cb_buf != NULL)
 - xfree(b-cb_buf);
 - xfree(b);
 + free(b-cb_buf);
 + free(b);
  }
  
  /*
   * Free the buffer b's structural information but do not free the contents
   * of the buffer.  Instead, they are returned and should be freed later using
 - * xfree().
 + * free().
   */
  void *
  buf_release(BUF *b)
 @@ -153,7 +153,7 @@ buf_release(BUF *b)
   void *tmp;
  
   tmp = b-cb_buf;
 - xfree(b);
 + free(b);
   return (tmp);
  }
  
 Index: ci.c
 ===
 RCS file: /cvs/src/usr.bin/rcs/ci.c,v
 retrieving revision 1.219
 diff -u -p -r1.219 ci.c
 --- ci.c  16 Jan 2015 06:40:11 -  1.219
 +++ ci.c  12 Jun 2015 22:20:32 -
 @@ -211,7 +211,7 @@ checkin_main(int argc, char **argv)
   exit(0);
   case 'w':
   if (pb.author != NULL)
 - xfree(pb.author);
 + free(pb.author);
   pb.author = xstrdup(rcs_optarg);
   break;
   case 'x':
 @@ -376,10 +376,8 @@ out:
   buf_free(b2);
   if (b3 != NULL)
   buf_free(b3);
 - if (path1 != NULL)
 - xfree(path1);
 - if (path2 != NULL)
 - xfree(path2);
 + free(path1);
 + free(path2);
  
   return (NULL);
  }
 @@ -511,7 +509,7 @@ checkin_update(struct checkin_params *pb
   fprintf(stderr,
   reuse log message of previous file? [yn](y): );
   if (rcs_yesno('y') != 'y') {
 - xfree(pb-rcs_msg);
 + free(pb-rcs_msg);
   pb-rcs_msg = NULL;
   }
   }
 @@ -584,7 +582,7 @@ checkin_update(struct checkin_params *pb
   pb-username, pb-author, NULL, NULL);
  
   if ((pb-flags  INTERACTIVE)  (pb-rcs_msg[0] == '\0')) {
 - xfree(pb-rcs_msg); /* free empty log message */
 + free(pb-rcs_msg);  /* free empty log message */
   pb-rcs_msg = NULL;
   }
  
 @@ -988,25 +986,22 @@ checkin_parsekeyword(char *keystring, RC
   (void)xasprintf(datestring, %s %s, tokens[3], tokens[4]);
   if ((*date = date_parse(datestring)) == -1)
   errx(1, could not parse date);
 - xfree(datestring);
 + free(datestring);
  
   if (i  6)
   break;
 - if (*author != NULL)
 - xfree(*author);
 + free(*author);
   *author = xstrdup(tokens[5]);
  
   if (i  7)
   break;
 - if (*state != NULL)
 - xfree(*state);
 + free(*state);
   *state = xstrdup(tokens[6]);
   break;
   case KW_TYPE_AUTHOR:
   if (i  2)
   break;
 - if (*author != NULL)
 - xfree(*author);
 + free(*author);
   *author = xstrdup(tokens[1]);
   break;
   case KW_TYPE_DATE:
 @@ -1015,13 +1010,12 @@ checkin_parsekeyword(char *keystring, RC
   (void)xasprintf(datestring, %s %s, tokens[1], tokens[2]);
   if ((*date = date_parse(datestring)) == -1)
   errx(1, could not parse date);
 - xfree(datestring);
 + free(datestring);
   break;
   case KW_TYPE_STATE:
   if (i  2)
   break;
 - if (*state != NULL)
 - xfree(*state);
 + free(*state);
   *state = xstrdup(tokens[1]);
   break;
   case KW_TYPE_REVISION:
 Index: co.c
 

Re: [patch]rcs: remove xfree

2015-06-13 Thread Nicholas Marriott

looks good to me now, ok anyone?


On Sat, Jun 13, 2015 at 03:43:47PM +0200, Fritjof Bornebusch wrote:
 On Sat, Jun 13, 2015 at 09:33:59AM +0100, Nicholas Marriott wrote:
  Hi. You missed date.y:
  
  date.y: In function 'yyerror':
  date.y:497: error: implicit declaration of function 'xfree'
  
 
 Ups, sorry.
 That should do the trick.
 
  
  On Sat, Jun 13, 2015 at 12:43:29AM +0200, Fritjof Bornebusch wrote:
Hi tech@,

   
   Without PGP / SMIME stuff, sorry.

a couple of months ago I removed the if condition in the *xfree* 
function, but tedu@ suggested
that it would be better to remove the *xfree* function entirely instead.

If've seen there are *efree* functions in some tools, that just wrappes 
the free(3) function call.
I'm not quite sure what is the best way todo it, so comments are very 
welcome.
 
Regards,
--F.
   
  
 Index: buf.c
 ===
 RCS file: /cvs/src/usr.bin/rcs/buf.c,v
 retrieving revision 1.24
 diff -u -p -r1.24 buf.c
 --- buf.c 5 Feb 2015 12:59:58 -   1.24
 +++ buf.c 12 Jun 2015 22:20:32 -
 @@ -32,6 +32,7 @@
  #include fcntl.h
  #include stdint.h
  #include stdio.h
 +#include stdlib.h
  #include string.h
  #include unistd.h
  
 @@ -137,15 +138,14 @@ out:
  void
  buf_free(BUF *b)
  {
 - if (b-cb_buf != NULL)
 - xfree(b-cb_buf);
 - xfree(b);
 + free(b-cb_buf);
 + free(b);
  }
  
  /*
   * Free the buffer b's structural information but do not free the contents
   * of the buffer.  Instead, they are returned and should be freed later using
 - * xfree().
 + * free().
   */
  void *
  buf_release(BUF *b)
 @@ -153,7 +153,7 @@ buf_release(BUF *b)
   void *tmp;
  
   tmp = b-cb_buf;
 - xfree(b);
 + free(b);
   return (tmp);
  }
  
 Index: ci.c
 ===
 RCS file: /cvs/src/usr.bin/rcs/ci.c,v
 retrieving revision 1.219
 diff -u -p -r1.219 ci.c
 --- ci.c  16 Jan 2015 06:40:11 -  1.219
 +++ ci.c  12 Jun 2015 22:20:32 -
 @@ -211,7 +211,7 @@ checkin_main(int argc, char **argv)
   exit(0);
   case 'w':
   if (pb.author != NULL)
 - xfree(pb.author);
 + free(pb.author);
   pb.author = xstrdup(rcs_optarg);
   break;
   case 'x':
 @@ -376,10 +376,8 @@ out:
   buf_free(b2);
   if (b3 != NULL)
   buf_free(b3);
 - if (path1 != NULL)
 - xfree(path1);
 - if (path2 != NULL)
 - xfree(path2);
 + free(path1);
 + free(path2);
  
   return (NULL);
  }
 @@ -511,7 +509,7 @@ checkin_update(struct checkin_params *pb
   fprintf(stderr,
   reuse log message of previous file? [yn](y): );
   if (rcs_yesno('y') != 'y') {
 - xfree(pb-rcs_msg);
 + free(pb-rcs_msg);
   pb-rcs_msg = NULL;
   }
   }
 @@ -584,7 +582,7 @@ checkin_update(struct checkin_params *pb
   pb-username, pb-author, NULL, NULL);
  
   if ((pb-flags  INTERACTIVE)  (pb-rcs_msg[0] == '\0')) {
 - xfree(pb-rcs_msg); /* free empty log message */
 + free(pb-rcs_msg);  /* free empty log message */
   pb-rcs_msg = NULL;
   }
  
 @@ -988,25 +986,22 @@ checkin_parsekeyword(char *keystring, RC
   (void)xasprintf(datestring, %s %s, tokens[3], tokens[4]);
   if ((*date = date_parse(datestring)) == -1)
   errx(1, could not parse date);
 - xfree(datestring);
 + free(datestring);
  
   if (i  6)
   break;
 - if (*author != NULL)
 - xfree(*author);
 + free(*author);
   *author = xstrdup(tokens[5]);
  
   if (i  7)
   break;
 - if (*state != NULL)
 - xfree(*state);
 + free(*state);
   *state = xstrdup(tokens[6]);
   break;
   case KW_TYPE_AUTHOR:
   if (i  2)
   break;
 - if (*author != NULL)
 - xfree(*author);
 + free(*author);
   *author = xstrdup(tokens[1]);
   break;
   case KW_TYPE_DATE:
 @@ -1015,13 +1010,12 @@ checkin_parsekeyword(char *keystring, RC
   (void)xasprintf(datestring, %s %s, tokens[1], tokens[2]);
   if ((*date = date_parse(datestring)) == -1)
   errx(1, could not parse date);
 - xfree(datestring);
 + free(datestring);
   break;
   case KW_TYPE_STATE:
   if (i  2)
 

Re: [patch]rcs: remove xfree

2015-06-13 Thread Nicholas Marriott
Applied now, thanks.


On Sat, Jun 13, 2015 at 09:06:23PM +0100, Nicholas Marriott wrote:
 
 looks good to me now, ok anyone?
 
 
 On Sat, Jun 13, 2015 at 03:43:47PM +0200, Fritjof Bornebusch wrote:
  On Sat, Jun 13, 2015 at 09:33:59AM +0100, Nicholas Marriott wrote:
   Hi. You missed date.y:
   
   date.y: In function 'yyerror':
   date.y:497: error: implicit declaration of function 'xfree'
   
  
  Ups, sorry.
  That should do the trick.
  
   
   On Sat, Jun 13, 2015 at 12:43:29AM +0200, Fritjof Bornebusch wrote:
 Hi tech@,
 

Without PGP / SMIME stuff, sorry.
 
 a couple of months ago I removed the if condition in the *xfree* 
 function, but tedu@ suggested
 that it would be better to remove the *xfree* function entirely 
 instead.
 
 If've seen there are *efree* functions in some tools, that just 
 wrappes the free(3) function call.
 I'm not quite sure what is the best way todo it, so comments are very 
 welcome.
  
 Regards,
 --F.

   
  Index: buf.c
  ===
  RCS file: /cvs/src/usr.bin/rcs/buf.c,v
  retrieving revision 1.24
  diff -u -p -r1.24 buf.c
  --- buf.c   5 Feb 2015 12:59:58 -   1.24
  +++ buf.c   12 Jun 2015 22:20:32 -
  @@ -32,6 +32,7 @@
   #include fcntl.h
   #include stdint.h
   #include stdio.h
  +#include stdlib.h
   #include string.h
   #include unistd.h
   
  @@ -137,15 +138,14 @@ out:
   void
   buf_free(BUF *b)
   {
  -   if (b-cb_buf != NULL)
  -   xfree(b-cb_buf);
  -   xfree(b);
  +   free(b-cb_buf);
  +   free(b);
   }
   
   /*
* Free the buffer b's structural information but do not free the 
  contents
* of the buffer.  Instead, they are returned and should be freed later 
  using
  - * xfree().
  + * free().
*/
   void *
   buf_release(BUF *b)
  @@ -153,7 +153,7 @@ buf_release(BUF *b)
  void *tmp;
   
  tmp = b-cb_buf;
  -   xfree(b);
  +   free(b);
  return (tmp);
   }
   
  Index: ci.c
  ===
  RCS file: /cvs/src/usr.bin/rcs/ci.c,v
  retrieving revision 1.219
  diff -u -p -r1.219 ci.c
  --- ci.c16 Jan 2015 06:40:11 -  1.219
  +++ ci.c12 Jun 2015 22:20:32 -
  @@ -211,7 +211,7 @@ checkin_main(int argc, char **argv)
  exit(0);
  case 'w':
  if (pb.author != NULL)
  -   xfree(pb.author);
  +   free(pb.author);
  pb.author = xstrdup(rcs_optarg);
  break;
  case 'x':
  @@ -376,10 +376,8 @@ out:
  buf_free(b2);
  if (b3 != NULL)
  buf_free(b3);
  -   if (path1 != NULL)
  -   xfree(path1);
  -   if (path2 != NULL)
  -   xfree(path2);
  +   free(path1);
  +   free(path2);
   
  return (NULL);
   }
  @@ -511,7 +509,7 @@ checkin_update(struct checkin_params *pb
  fprintf(stderr,
  reuse log message of previous file? [yn](y): );
  if (rcs_yesno('y') != 'y') {
  -   xfree(pb-rcs_msg);
  +   free(pb-rcs_msg);
  pb-rcs_msg = NULL;
  }
  }
  @@ -584,7 +582,7 @@ checkin_update(struct checkin_params *pb
  pb-username, pb-author, NULL, NULL);
   
  if ((pb-flags  INTERACTIVE)  (pb-rcs_msg[0] == '\0')) {
  -   xfree(pb-rcs_msg); /* free empty log message */
  +   free(pb-rcs_msg);  /* free empty log message */
  pb-rcs_msg = NULL;
  }
   
  @@ -988,25 +986,22 @@ checkin_parsekeyword(char *keystring, RC
  (void)xasprintf(datestring, %s %s, tokens[3], tokens[4]);
  if ((*date = date_parse(datestring)) == -1)
  errx(1, could not parse date);
  -   xfree(datestring);
  +   free(datestring);
   
  if (i  6)
  break;
  -   if (*author != NULL)
  -   xfree(*author);
  +   free(*author);
  *author = xstrdup(tokens[5]);
   
  if (i  7)
  break;
  -   if (*state != NULL)
  -   xfree(*state);
  +   free(*state);
  *state = xstrdup(tokens[6]);
  break;
  case KW_TYPE_AUTHOR:
  if (i  2)
  break;
  -   if (*author != NULL)
  -   xfree(*author);
  +   free(*author);
  *author = xstrdup(tokens[1]);
  break;
  case KW_TYPE_DATE:
  @@ -1015,13 +1010,12 @@ checkin_parsekeyword(char *keystring, RC
  (void)xasprintf(datestring, %s %s, tokens[1], tokens[2]);
  if ((*date = date_parse(datestring)) == -1)
  errx(1, could not parse date);
  -   xfree(datestring);
  + 

[patch]rcs: remove xfree

2015-06-12 Thread Fritjof Bornebusch
 Hi tech@,
 

Without PGP / SMIME stuff, sorry.
 
 a couple of months ago I removed the if condition in the *xfree* function, 
 but tedu@ suggested
 that it would be better to remove the *xfree* function entirely instead.
 
 If've seen there are *efree* functions in some tools, that just wrappes the 
 free(3) function call.
 I'm not quite sure what is the best way todo it, so comments are very welcome.
  
 Regards,
 --F.
 
Index: buf.c
===
RCS file: /cvs/src/usr.bin/rcs/buf.c,v
retrieving revision 1.24
diff -u -p -r1.24 buf.c
--- buf.c   5 Feb 2015 12:59:58 -   1.24
+++ buf.c   12 Jun 2015 22:20:32 -
@@ -32,6 +32,7 @@
 #include fcntl.h
 #include stdint.h
 #include stdio.h
+#include stdlib.h
 #include string.h
 #include unistd.h
 
@@ -137,15 +138,14 @@ out:
 void
 buf_free(BUF *b)
 {
-   if (b-cb_buf != NULL)
-   xfree(b-cb_buf);
-   xfree(b);
+   free(b-cb_buf);
+   free(b);
 }
 
 /*
  * Free the buffer b's structural information but do not free the contents
  * of the buffer.  Instead, they are returned and should be freed later using
- * xfree().
+ * free().
  */
 void *
 buf_release(BUF *b)
@@ -153,7 +153,7 @@ buf_release(BUF *b)
void *tmp;
 
tmp = b-cb_buf;
-   xfree(b);
+   free(b);
return (tmp);
 }
 
Index: ci.c
===
RCS file: /cvs/src/usr.bin/rcs/ci.c,v
retrieving revision 1.219
diff -u -p -r1.219 ci.c
--- ci.c16 Jan 2015 06:40:11 -  1.219
+++ ci.c12 Jun 2015 22:20:32 -
@@ -211,7 +211,7 @@ checkin_main(int argc, char **argv)
exit(0);
case 'w':
if (pb.author != NULL)
-   xfree(pb.author);
+   free(pb.author);
pb.author = xstrdup(rcs_optarg);
break;
case 'x':
@@ -376,10 +376,8 @@ out:
buf_free(b2);
if (b3 != NULL)
buf_free(b3);
-   if (path1 != NULL)
-   xfree(path1);
-   if (path2 != NULL)
-   xfree(path2);
+   free(path1);
+   free(path2);
 
return (NULL);
 }
@@ -511,7 +509,7 @@ checkin_update(struct checkin_params *pb
fprintf(stderr,
reuse log message of previous file? [yn](y): );
if (rcs_yesno('y') != 'y') {
-   xfree(pb-rcs_msg);
+   free(pb-rcs_msg);
pb-rcs_msg = NULL;
}
}
@@ -584,7 +582,7 @@ checkin_update(struct checkin_params *pb
pb-username, pb-author, NULL, NULL);
 
if ((pb-flags  INTERACTIVE)  (pb-rcs_msg[0] == '\0')) {
-   xfree(pb-rcs_msg); /* free empty log message */
+   free(pb-rcs_msg);  /* free empty log message */
pb-rcs_msg = NULL;
}
 
@@ -988,25 +986,22 @@ checkin_parsekeyword(char *keystring, RC
(void)xasprintf(datestring, %s %s, tokens[3], tokens[4]);
if ((*date = date_parse(datestring)) == -1)
errx(1, could not parse date);
-   xfree(datestring);
+   free(datestring);
 
if (i  6)
break;
-   if (*author != NULL)
-   xfree(*author);
+   free(*author);
*author = xstrdup(tokens[5]);
 
if (i  7)
break;
-   if (*state != NULL)
-   xfree(*state);
+   free(*state);
*state = xstrdup(tokens[6]);
break;
case KW_TYPE_AUTHOR:
if (i  2)
break;
-   if (*author != NULL)
-   xfree(*author);
+   free(*author);
*author = xstrdup(tokens[1]);
break;
case KW_TYPE_DATE:
@@ -1015,13 +1010,12 @@ checkin_parsekeyword(char *keystring, RC
(void)xasprintf(datestring, %s %s, tokens[1], tokens[2]);
if ((*date = date_parse(datestring)) == -1)
errx(1, could not parse date);
-   xfree(datestring);
+   free(datestring);
break;
case KW_TYPE_STATE:
if (i  2)
break;
-   if (*state != NULL)
-   xfree(*state);
+   free(*state);
*state = xstrdup(tokens[1]);
break;
case KW_TYPE_REVISION:
Index: co.c
===
RCS file: /cvs/src/usr.bin/rcs/co.c,v
retrieving revision 1.120
diff -u -p -r1.120 co.c
--- co.c16 Jan 2015 06:40:11 - 

[patch]rcs: remove xfree

2015-06-12 Thread Fritjof Bornebusch
Hi tech@,

a couple of months ago I removed the if condition in the *xfree* function, but 
tedu@ suggested
that it would be better to remove the *xfree* function entirely instead.

If've seen there are *efree* functions in some tools, that just wrappes the 
free(3) function call.
I'm not quite sure what is the best way todo it, so comments are very welcome.

Regards,
--F.


Index: buf.c
===
RCS file: /cvs/src/usr.bin/rcs/buf.c,v
retrieving revision 1.24
diff -u -p -r1.24 buf.c
--- buf.c   5 Feb 2015 12:59:58 -   1.24
+++ buf.c   12 Jun 2015 22:20:32 -
@@ -32,6 +32,7 @@
 #include fcntl.h
 #include stdint.h
 #include stdio.h
+#include stdlib.h
 #include string.h
 #include unistd.h
 
@@ -137,15 +138,14 @@ out:
 void
 buf_free(BUF *b)
 {
-   if (b-cb_buf != NULL)
-   xfree(b-cb_buf);
-   xfree(b);
+   free(b-cb_buf);
+   free(b);
 }
 
 /*
  * Free the buffer b's structural information but do not free the contents
  * of the buffer.  Instead, they are returned and should be freed later using
- * xfree().
+ * free().
  */
 void *
 buf_release(BUF *b)
@@ -153,7 +153,7 @@ buf_release(BUF *b)
void *tmp;
 
tmp = b-cb_buf;
-   xfree(b);
+   free(b);
return (tmp);
 }
 
Index: ci.c
===
RCS file: /cvs/src/usr.bin/rcs/ci.c,v
retrieving revision 1.219
diff -u -p -r1.219 ci.c
--- ci.c16 Jan 2015 06:40:11 -  1.219
+++ ci.c12 Jun 2015 22:20:32 -
@@ -211,7 +211,7 @@ checkin_main(int argc, char **argv)
exit(0);
case 'w':
if (pb.author != NULL)
-   xfree(pb.author);
+   free(pb.author);
pb.author = xstrdup(rcs_optarg);
break;
case 'x':
@@ -376,10 +376,8 @@ out:
buf_free(b2);
if (b3 != NULL)
buf_free(b3);
-   if (path1 != NULL)
-   xfree(path1);
-   if (path2 != NULL)
-   xfree(path2);
+   free(path1);
+   free(path2);
 
return (NULL);
 }
@@ -511,7 +509,7 @@ checkin_update(struct checkin_params *pb
fprintf(stderr,
reuse log message of previous file? [yn](y): );
if (rcs_yesno('y') != 'y') {
-   xfree(pb-rcs_msg);
+   free(pb-rcs_msg);
pb-rcs_msg = NULL;
}
}
@@ -584,7 +582,7 @@ checkin_update(struct checkin_params *pb
pb-username, pb-author, NULL, NULL);
 
if ((pb-flags  INTERACTIVE)  (pb-rcs_msg[0] == '\0')) {
-   xfree(pb-rcs_msg); /* free empty log message */
+   free(pb-rcs_msg);  /* free empty log message */
pb-rcs_msg = NULL;
}
 
@@ -988,25 +986,22 @@ checkin_parsekeyword(char *keystring, RC
(void)xasprintf(datestring, %s %s, tokens[3], tokens[4]);
if ((*date = date_parse(datestring)) == -1)
errx(1, could not parse date);
-   xfree(datestring);
+   free(datestring);
 
if (i  6)
break;
-   if (*author != NULL)
-   xfree(*author);
+   free(*author);
*author = xstrdup(tokens[5]);
 
if (i  7)
break;
-   if (*state != NULL)
-   xfree(*state);
+   free(*state);
*state = xstrdup(tokens[6]);
break;
case KW_TYPE_AUTHOR:
if (i  2)
break;
-   if (*author != NULL)
-   xfree(*author);
+   free(*author);
*author = xstrdup(tokens[1]);
break;
case KW_TYPE_DATE:
@@ -1015,13 +1010,12 @@ checkin_parsekeyword(char *keystring, RC
(void)xasprintf(datestring, %s %s, tokens[1], tokens[2]);
if ((*date = date_parse(datestring)) == -1)
errx(1, could not parse date);
-   xfree(datestring);
+   free(datestring);
break;
case KW_TYPE_STATE:
if (i  2)
break;
-   if (*state != NULL)
-   xfree(*state);
+   free(*state);
*state = xstrdup(tokens[1]);
break;
case KW_TYPE_REVISION:
Index: co.c
===
RCS file: /cvs/src/usr.bin/rcs/co.c,v
retrieving revision 1.120
diff -u -p -r1.120 co.c
--- co.c16 Jan 2015 06:40:11 -  1.120
+++ co.c12 Jun 2015 22:20:32