summaryrefslogtreecommitdiff
path: root/common-utils
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2013-05-23 12:56:26 -0700
committerAaron Plattner <aplattner@nvidia.com>2013-05-23 12:56:26 -0700
commit80e2b650b3280067c4435e401bfbeede5ff305fc (patch)
tree62e0fe7d927988629d7014d2139ab9b42685d686 /common-utils
parentefcc17c893c82380f0af98767f1cd2c7a39d8f6a (diff)
319.23319.23
Diffstat (limited to 'common-utils')
-rw-r--r--common-utils/common-utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common-utils/common-utils.c b/common-utils/common-utils.c
index 7b18294..9b734f3 100644
--- a/common-utils/common-utils.c
+++ b/common-utils/common-utils.c
@@ -725,7 +725,7 @@ char *nv_trim_space(char *string) {
char *ret, *end;
for (ret = string; *ret && isspace(*ret); ret++);
- for (end = ret + strlen(ret); end >= ret && isspace(*end); end--) {
+ for (end = ret + strlen(ret) - 1; end >= ret && isspace(*end); end--) {
*end = '\0';
}
@@ -745,13 +745,13 @@ static char *trim_char(char *string, char trim, int *count) {
return NULL;
}
- len = strlen(string);
-
if (string[0] == trim) {
string++;
replaced++;
}
+ len = strlen(string);
+
if (string[len - 1] == trim) {
string[len - 1] = '\0';
replaced++;