changeset 28886:3f60536745bd

(Freplace_match): Handle case of `\N' in the replacement when there's no group N.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 12 May 2000 09:21:59 +0000
parents 25c3b058b04e
children 0778eff185b6
files src/search.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Fri May 12 08:16:14 2000 +0000
+++ b/src/search.c	Fri May 12 09:21:59 2000 +0000
@@ -2454,8 +2454,8 @@
       for (pos_byte = 0, pos = 0; pos_byte < length;)
 	{
 	  unsigned char str[MAX_MULTIBYTE_LENGTH];
-	  unsigned char *add_stuff;
-	  int add_len;
+	  unsigned char *add_stuff = NULL;
+	  int add_len = 0;
 	  int idx = -1;
 
 	  if (str_multibyte)
@@ -2535,8 +2535,11 @@
 	    }
 
 	  /* Now add to the end of SUBSTED.  */
-	  bcopy (add_stuff, substed + substed_len, add_len);
-	  substed_len += add_len;
+	  if (add_stuff)
+	    {
+	      bcopy (add_stuff, substed + substed_len, add_len);
+	      substed_len += add_len;
+	    }
 	}
 
       /* Now insert what we accumulated.  */