summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/util.c45
-rw-r--r--lib/libalpm/util.h1
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);