index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dave Reisner <dreisner@archlinux.org> | 2012-05-28 17:32:11 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-06-25 23:04:31 -0500 |
commit | f556fe8b4a199116b5665bb5f0886e4c2962b077 (patch) | |
tree | da359a1cea95066f32962219e4909adf325c0df4 /lib/libalpm/util.c | |
parent | 74274b5dc347ba70e4abd1f329feb41538f82ff4 (diff) |
-rw-r--r-- | lib/libalpm/util.c | 8 |
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 8fd7a100..c2b5d443 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -195,15 +195,17 @@ cleanup: /** Trim trailing newlines from a string (if any exist). * @param str a single line of text + * @param len size of str, if known, else 0 * @return the length of the trimmed string */ -size_t _alpm_strip_newline(char *str) +size_t _alpm_strip_newline(char *str, size_t len) { - size_t len; if(*str == '\0') { return 0; } - len = strlen(str); + if(len == 0) { + len = strlen(str); + } while(len > 0 && str[len - 1] == '\n') { len--; } |