changeset 47218:66c5d66d21f6

(regex_tag_multiline, readline): Never pass pfnote a string that cannot be freed.
author Francesco Potortì <pot@gnu.org>
date Tue, 03 Sep 2002 15:21:07 +0000
parents 9c4aa309dfc5
children 89daaf4cc563
files lib-src/etags.c
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/etags.c	Tue Sep 03 12:18:20 2002 +0000
+++ b/lib-src/etags.c	Tue Sep 03 15:21:07 2002 +0000
@@ -35,7 +35,7 @@
  *
  */
 
-char pot_etags_version[] = "@(#) pot revision number is 16.54";
+char pot_etags_version[] = "@(#) pot revision number is $Revision: 16.55 $";
 
 #define	TRUE	1
 #define	FALSE	0
@@ -1871,6 +1871,7 @@
 {
   register node *np;
 
+  assert (name == NULL || name[0] != '\0');
   if (CTAGS && name == NULL)
     return;
 
@@ -5727,6 +5728,7 @@
       size -= 1;
 
   /* Allocate space and do the substitutions. */
+  assert (size >= 0);
   result = xnew (size + 1, char);
 
   for (t = result; *out != '\0'; out++)
@@ -5741,7 +5743,8 @@
       *t++ = *out;
   *t = '\0';
 
-  assert (t <= result + size && t - result == (int)strlen (result));
+  assert (t <= result + size);
+  assert (t - result == (int)strlen (result));
 
   return result;
 }
@@ -5828,8 +5831,9 @@
 		if (buffer[charno++] == '\n')
 		  lineno++, linecharno = charno;
 	      name = rp->name;
-	      if (name[0] != '\0')
-		/* Make a named tag. */
+	      if (name[0] == '\0')
+		name = NULL;
+	      else /* make a named tag */
 		name = substitute (buffer, rp->name, &rp->regs);
 	      if (rp->force_explicit_name)
 		/* Force explicit tag name, if a name is there. */
@@ -6151,8 +6155,9 @@
 	    default:
 	      /* Match occurred.  Construct a tag. */
 	      name = rp->name;
-	      if (name[0] != '\0')
-		/* Make a named tag. */
+	      if (name[0] == '\0')
+		name = NULL;
+	      else /* make a named tag */
 		name = substitute (lbp->buffer, rp->name, &rp->regs);
 	      if (rp->force_explicit_name)
 		/* Force explicit tag name, if a name is there. */