diff options
author | Keith Kanios <keith@kanios.net> | 2011-04-09 10:33:06 -0500 |
---|---|---|
committer | Keith Kanios <keith@kanios.net> | 2011-04-09 10:33:06 -0500 |
commit | 918317c4ce857458b219b132094eacd8e9b96931 (patch) | |
tree | 1b9e48e54966abb05b166c3d11def0c54ade9780 /nasmlib.c | |
parent | 256901bbbc124cd359611df6405dd6ec718b1448 (diff) | |
download | nasm-918317c4ce857458b219b132094eacd8e9b96931.tar.gz nasm-918317c4ce857458b219b132094eacd8e9b96931.tar.bz2 nasm-918317c4ce857458b219b132094eacd8e9b96931.zip |
Revert "nasmlib: added string replace (strrep) utility function"
This reverts commit dd9c9752ead3a39fec6f050bfe3ac8768defc02f.
Diffstat (limited to 'nasmlib.c')
-rw-r--r-- | nasmlib.c | 80 |
1 files changed, 0 insertions, 80 deletions
@@ -290,86 +290,6 @@ char *nasm_strsep(char **stringp, const char *delim) } #endif -char *nasm_strrep(const char *str, const char *sub, char *lin, bool casesense) -{ - char *outline = lin; - char *temp1 = NULL; - char *temp2 = NULL; - char *l, *lp, *lt, *ls; - int count = 0; - int str_len, sub_len, lin_len; - int i, c; - - str_len = strlen(str); - sub_len = strlen(sub); - lin_len = strlen(lin); - - if ((str_len > 0) && (lin_len > 0)) { - if (casesense == false) { - l = nasm_strdup(lin); - for (i = 0; i < lin_len; i++) { - l[i] = (char)nasm_tolower_tab[(int)l[i]]; - } - ls = nasm_strdup(str); - for (i = 0; i < str_len; i++) { - ls[i] = (char)nasm_tolower_tab[(int)ls[i]]; - } - temp1 = l; - temp2 = ls; - } else { - l = lin; - ls = (char *)str; - } - - lt = l; - - do { - l = strstr(l, ls); - if (l != NULL) { - count ++; - l += str_len; - } - } while (l != NULL); - - if (count > 0) { - i = (lin_len - (count * str_len)); - i += (count * sub_len); - outline = nasm_zalloc(i); - - l = lt; - - for (i = 0; i < count; i ++) { - lp = l; - l = strstr(l, ls); - c = (lp - l); - if (c > 0) { - strncat(outline, lt, c); - } - strncat(outline, sub, sub_len); - l += str_len; - lt += str_len; - } - - c = (l - lin); - if (c < lin_len) { - strcat(outline, lt); - } - - if (temp2 != NULL) { - nasm_free(temp2); - } - - if (temp1 != NULL) { - nasm_free(temp1); - } - - nasm_free(lin); - } - } - - return outline; -} - #define lib_isnumchar(c) (nasm_isalnum(c) || (c) == '$' || (c) == '_') #define numvalue(c) ((c)>='a' ? (c)-'a'+10 : (c)>='A' ? (c)-'A'+10 : (c)-'0') |