summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-12-23 11:57:19 -0500
committerDan McGee <dan@archlinux.org>2011-12-23 14:37:03 -0600
commitbec0b0c8234e9fafbf442c4eb18f92e984ee2516 (patch)
treecb8bf68d25b70aface40d8422391a767097a1163
parent6b29374a60e1568ba626b88ca1b1da915ca0a438 (diff)
downloadpacman-bec0b0c8234e9fafbf442c4eb18f92e984ee2516.tar.xz
pactree: update with new strtrim function
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--src/util/pactree.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/util/pactree.c b/src/util/pactree.c
index 55d63d7c..77ee75e8 100644
--- a/src/util/pactree.c
+++ b/src/util/pactree.c
@@ -117,13 +117,13 @@ char *strndup(const char *s, size_t n)
}
#endif
-static char *strtrim(char *str)
+static size_t strtrim(char *str)
{
- char *pch = str;
+ char *end, *pch = str;
if(str == NULL || *str == '\0') {
/* string is empty, so we're done. */
- return str;
+ return 0;
}
while(isspace((unsigned char)*pch)) {
@@ -140,16 +140,16 @@ static char *strtrim(char *str)
/* check if there wasn't anything but whitespace in the string. */
if(*str == '\0') {
- return str;
+ return 0;
}
- pch = (str + (strlen(str) - 1));
- while(isspace((unsigned char)*pch)) {
- pch--;
+ end = (str + strlen(str) - 1);
+ while(isspace((unsigned char)*end)) {
+ end--;
}
- *++pch = '\0';
+ *++end = '\0';
- return str;
+ return end - pch;
}
static int register_syncs(void) {