diff options
author | Xavier Chantry <shiningxc@gmail.com> | 2009-09-07 01:13:24 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-09-07 02:09:45 +0200 |
commit | 845f21207c53c36c02f14343dcf4dbbca5462ce0 (patch) | |
tree | b4fccf8710cefc720aaa7cf77682f54ba5952d66 /lib/libalpm | |
parent | 0845b2f13cef6db23a4a281976ec1374e93b7c4e (diff) | |
download | pacman-845f21207c53c36c02f14343dcf4dbbca5462ce0.tar.gz pacman-845f21207c53c36c02f14343dcf4dbbca5462ce0.tar.xz |
libalpm/util.c : remove _alpm_strreplace
This function is unused since commit
358cc5804a2df873180e6d9ef2420ab3247f8437.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: also kill from util.h]
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/util.c | 45 | ||||
-rw-r--r-- | lib/libalpm/util.h | 1 |
2 files changed, 0 insertions, 46 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 082c095b..f78d193a 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -196,51 +196,6 @@ char *_alpm_strtrim(char *str) return(str); } -/* Helper function for _alpm_strreplace */ -static void _strnadd(char **str, const char *append, unsigned int count) -{ - if(*str) { - *str = realloc(*str, strlen(*str) + count + 1); - } else { - *str = calloc(count + 1, sizeof(char)); - } - - strncat(*str, append, count); -} - -/* Replace all occurances of 'needle' with 'replace' in 'str', returning - * a new string (must be free'd) */ -char *_alpm_strreplace(const char *str, const char *needle, const char *replace) -{ - const char *p, *q; - p = q = str; - - char *newstr = NULL; - unsigned int needlesz = strlen(needle), - replacesz = strlen(replace); - - while (1) { - q = strstr(p, needle); - if(!q) { /* not found */ - if(*p) { - /* add the rest of 'p' */ - _strnadd(&newstr, p, strlen(p)); - } - break; - } else { /* found match */ - if(q > p){ - /* add chars between this occurance and last occurance, if any */ - _strnadd(&newstr, p, q - p); - } - _strnadd(&newstr, replace, replacesz); - p = q + needlesz; - } - } - - return newstr; -} - - /* Create a lock file */ int _alpm_lckmk() { diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 4bc8b92f..ccf169d3 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -60,7 +60,6 @@ int _alpm_makepath(const char *path); int _alpm_makepath_mode(const char *path, mode_t mode); int _alpm_copyfile(const char *src, const char *dest); char *_alpm_strtrim(char *str); -char *_alpm_strreplace(const char *str, const char *needle, const char *replace); int _alpm_lckmk(); int _alpm_lckrm(); int _alpm_unpack(const char *archive, const char *prefix, const char *fn); |