|
Check-in Number:
|
1947 | |
| Date: |
2002-Mar-06 11:04:29 (local)
2002-Mar-06 10:04:29 (UTC) |
| User: | rse |
| Branch: | |
| Comment: |
Fix a soon to occur bug in advance:
a search and replace operation on an empty token buffer has to result
again in an empty token buffer and not an undefined token buffer.
I do not know why this worked and only crashes with the forthcoming
changed ${name:-default} behaviour (because this is totally unrelated
I would say). But nevertheless, this is a bug. So fix it, although it
works before and after the fix as good as it could ;) |
| Tickets: |
|
| Inspections: |
|
| Files: |
|
ossp-pkg/var/var.c 1.78 -> 1.79
--- var.c 2002/03/04 13:12:23 1.78
+++ var.c 2002/03/06 10:04:29 1.79
@@ -249,7 +249,8 @@
}
/* append the data at the end of the current buffer. */
- memcpy((char *)output->end, data, len);
+ if (len > 0)
+ memcpy((char *)output->end, data, len);
output->end += len;
*((char *)output->end) = NUL;
return 1;
@@ -905,6 +906,7 @@
}
/* Match the pattern and create the result string in the tmp buffer. */
+ tokenbuf_append(&tmp, "", 0);
for (p = mydata.begin; p != mydata.end; ) {
if (p == mydata.begin || p[-1] == '\n')
regexec_flag = 0;
|
|