comparison src/search.c @ 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 b6f06a755c7d
children 2f43c508a9b5
comparison
equal deleted inserted replaced
28885:25c3b058b04e 28886:3f60536745bd
2452 buffer. */ 2452 buffer. */
2453 2453
2454 for (pos_byte = 0, pos = 0; pos_byte < length;) 2454 for (pos_byte = 0, pos = 0; pos_byte < length;)
2455 { 2455 {
2456 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2456 unsigned char str[MAX_MULTIBYTE_LENGTH];
2457 unsigned char *add_stuff; 2457 unsigned char *add_stuff = NULL;
2458 int add_len; 2458 int add_len = 0;
2459 int idx = -1; 2459 int idx = -1;
2460 2460
2461 if (str_multibyte) 2461 if (str_multibyte)
2462 { 2462 {
2463 FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte); 2463 FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte);
2533 substed = (unsigned char *) xrealloc (substed, 2533 substed = (unsigned char *) xrealloc (substed,
2534 substed_alloc_size + 1); 2534 substed_alloc_size + 1);
2535 } 2535 }
2536 2536
2537 /* Now add to the end of SUBSTED. */ 2537 /* Now add to the end of SUBSTED. */
2538 bcopy (add_stuff, substed + substed_len, add_len); 2538 if (add_stuff)
2539 substed_len += add_len; 2539 {
2540 bcopy (add_stuff, substed + substed_len, add_len);
2541 substed_len += add_len;
2542 }
2540 } 2543 }
2541 2544
2542 /* Now insert what we accumulated. */ 2545 /* Now insert what we accumulated. */
2543 insert_and_inherit (substed, substed_len); 2546 insert_and_inherit (substed, substed_len);
2544 2547