summaryrefslogtreecommitdiff
path: root/nasmlib.c
diff options
context:
space:
mode:
authorKeith Kanios <keith@kanios.net>2011-04-09 10:30:20 -0500
committerKeith Kanios <keith@kanios.net>2011-04-09 10:30:20 -0500
commit256901bbbc124cd359611df6405dd6ec718b1448 (patch)
tree2cf6d30ba7ed0fc0b194145cd2e1809142c0669c /nasmlib.c
parentf16401f9aabb550a556d3a462f428a3b52f6f9c3 (diff)
downloadnasm-256901bbbc124cd359611df6405dd6ec718b1448.tar.gz
nasm-256901bbbc124cd359611df6405dd6ec718b1448.tar.bz2
nasm-256901bbbc124cd359611df6405dd6ec718b1448.zip
Revert "nasmlib.c: fix issues with strrep utility function"
This reverts commit f16401f9aabb550a556d3a462f428a3b52f6f9c3.
Diffstat (limited to 'nasmlib.c')
-rw-r--r--nasmlib.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/nasmlib.c b/nasmlib.c
index c08ef09..538223f 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) {