FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 12-23-2011, 09:43 PM
Dave Reisner
 
Default pactree: update with new strtrim function

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
src/util/pactree.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/util/pactree.c b/src/util/pactree.c
index 55d63d7..77ee75e 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 == '') {
/* 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 == '') {
- 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 = '';
+ *++end = '';

- return str;
+ return end - pch;
}

static int register_syncs(void) {
--
1.7.8.1
 

Thread Tools




All times are GMT. The time now is 12:53 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org