summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nasmlib.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/nasmlib.c b/nasmlib.c
index c08ef09d..538223f8 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -295,7 +295,7 @@ char *nasm_strrep(const char *str, const char *sub, char *lin, bool casesense)
char *outline = lin;
char *temp1 = NULL;
char *temp2 = NULL;
- char *l, *ll, *lp, *lt, *ls;
+ char *l, *lp, *lt, *ls;
int count = 0;
int str_len, sub_len, lin_len;
int i, c;
@@ -321,7 +321,7 @@ char *nasm_strrep(const char *str, const char *sub, char *lin, bool casesense)
ls = (char *)str;
}
- ll = l;
+ lt = l;
do {
l = strstr(l, ls);
@@ -336,25 +336,23 @@ char *nasm_strrep(const char *str, const char *sub, char *lin, bool casesense)
i += (count * sub_len);
outline = nasm_zalloc(i);
- l = ll;
- lt = lin;
+ l = lt;
- for (i = 0; i < count; i++) {
+ for (i = 0; i < count; i ++) {
lp = l;
l = strstr(l, ls);
- c = (l - lp);
+ c = (lp - l);
if (c > 0) {
strncat(outline, lt, c);
- lt += c;
}
strncat(outline, sub, sub_len);
l += str_len;
lt += str_len;
}
- c = (l - ll);
+ c = (l - lin);
if (c < lin_len) {
- strncat(outline, lt, (lin_len-c));
+ strcat(outline, lt);
}
if (temp2 != NULL) {