diff options
author | Jim Meyering <meyering@redhat.com> | 2011-05-29 23:15:36 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-05-29 23:15:49 +0200 |
commit | 44019e149cf40caa0b6d0eb57115eea555fdfee6 (patch) | |
tree | 078c5fe2e3fd0ff4f893f86fde1d843d6a50f5d9 /lib/trim.c | |
parent | 05f391a9c40aaf461aacd0a27fc90bfaafdc5ccc (diff) | |
download | gnulib-44019e149cf40caa0b6d0eb57115eea555fdfee6.tar.gz |
trim: remove three superfluous assignments
* lib/trim.c (trim2): Remove three superfluous assignments
and correct brace positioning.
Diffstat (limited to 'lib/trim.c')
-rw-r--r-- | lib/trim.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/lib/trim.c b/lib/trim.c index 6515cfaff2..155063eed3 100644 --- a/lib/trim.c +++ b/lib/trim.c @@ -73,10 +73,7 @@ trim2 (const char *s, int how) for (; mbi_avail (i); mbi_advance (i)) { if (state == 0 && mb_isspace (mbi_cur (i))) - { - state = 0; - continue; - } + continue; if (state == 0 && !mb_isspace (mbi_cur (i))) { @@ -85,10 +82,7 @@ trim2 (const char *s, int how) } if (state == 1 && !mb_isspace (mbi_cur (i))) - { - state = 1; - continue; - } + continue; if (state == 1 && mb_isspace (mbi_cur (i))) { @@ -97,7 +91,7 @@ trim2 (const char *s, int how) } else if (state == 2 && mb_isspace (mbi_cur (i))) { - state = 2; + /* empty */ } else { @@ -114,18 +108,21 @@ trim2 (const char *s, int how) char *p; /* Trim leading whitespaces. */ - if (how != TRIM_TRAILING) { - for (p = d; *p && isspace ((unsigned char) *p); p++) - ; + if (how != TRIM_TRAILING) + { + for (p = d; *p && isspace ((unsigned char) *p); p++) + ; - memmove (d, p, strlen (p) + 1); - } + memmove (d, p, strlen (p) + 1); + } /* Trim trailing whitespaces. */ - if (how != TRIM_LEADING) { - for (p = d + strlen (d) - 1; p >= d && isspace ((unsigned char) *p); p--) - *p = '\0'; - } + if (how != TRIM_LEADING) + { + for (p = d + strlen (d) - 1; + p >= d && isspace ((unsigned char) *p); p--) + *p = '\0'; + } } return d; |