diff options
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r-- | src/pacman/util.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c index 3d71d8b0..1542f8a2 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -29,7 +29,6 @@ #include <stdint.h> /* intmax_t */ #include <string.h> #include <errno.h> -#include <ctype.h> #include <dirent.h> #include <unistd.h> #include <limits.h> @@ -353,44 +352,6 @@ void indentprint(const char *str, unsigned short indent, unsigned short cols) free(wcstr); } -/* Trim whitespace and newlines from a string - */ -size_t strtrim(char *str) -{ - char *end, *pch = str; - - if(str == NULL || *str == '\0') { - /* string is empty, so we're done. */ - return 0; - } - - while(isspace((unsigned char)*pch)) { - pch++; - } - if(pch != str) { - size_t len = strlen(pch); - if(len) { - memmove(str, pch, len + 1); - pch = str; - } else { - *str = '\0'; - } - } - - /* check if there wasn't anything but whitespace in the string. */ - if(*str == '\0') { - return 0; - } - - end = (str + strlen(str) - 1); - while(isspace((unsigned char)*end)) { - end--; - } - *++end = '\0'; - - return end - pch; -} - /* Replace all occurrences of 'needle' with 'replace' in 'str', returning * a new string (must be free'd) */ char *strreplace(const char *str, const char *needle, const char *replace) |