diff options
author | Ondrej Oprala | 2013-09-23 15:39:34 +0200 |
---|---|---|
committer | Karel Zak | 2013-11-08 14:14:34 +0100 |
commit | 675de3f5c190cc4fbdf3d05e2b86731a9772398e (patch) | |
tree | a9058b9ecf7e2bb8dd242cb7057a6a6c89da41e0 /libmount/src/tab_parse.c | |
parent | hexdump: rename in() to first_letter() (diff) | |
download | kernel-qcow2-util-linux-675de3f5c190cc4fbdf3d05e2b86731a9772398e.tar.gz kernel-qcow2-util-linux-675de3f5c190cc4fbdf3d05e2b86731a9772398e.tar.xz kernel-qcow2-util-linux-675de3f5c190cc4fbdf3d05e2b86731a9772398e.zip |
strutils: add skip_space() function
[kzak@redhat.com: - add also skip_blank(),
- remove duplicate implementation from libmount]
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab_parse.c')
-rw-r--r-- | libmount/src/tab_parse.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c index 532f0ec04..9246d420b 100644 --- a/libmount/src/tab_parse.c +++ b/libmount/src/tab_parse.c @@ -22,15 +22,6 @@ #include "pathnames.h" #include "strutils.h" -static inline char *skip_spaces(char *s) -{ - assert(s); - - while (*s == ' ' || *s == '\t') - s++; - return s; -} - static int next_number(char **s, int *num) { char *end = NULL; @@ -38,7 +29,7 @@ static int next_number(char **s, int *num) assert(num); assert(s); - *s = skip_spaces(*s); + *s = (char *) skip_blank(*s); if (!**s) return -1; *num = strtol(*s, &end, 10); @@ -111,7 +102,7 @@ static int mnt_parse_table_line(struct libmnt_fs *fs, char *s) fs->passno = fs->freq = 0; if (xrc == 4 && n) - s = skip_spaces(s + n); + s = (char *) skip_blank(s + n); if (xrc == 4 && *s) { if (next_number(&s, &fs->freq) != 0) { if (*s) { @@ -346,7 +337,7 @@ static int guess_table_format(char *line) static int is_comment_line(char *line) { - char *p = skip_spaces(line); + char *p = (char *) skip_blank(line); if (p && (*p == '#' || *p == '\n')) return 1; @@ -474,7 +465,7 @@ next_line: *s = '\0'; if (--s >= buf && *s == '\r') *s = '\0'; - s = skip_spaces(buf); + s = (char *) skip_blank(buf); } while (*s == '\0' || *s == '#'); if (tb->fmt == MNT_FMT_GUESS) { |