summaryrefslogtreecommitdiffstats
path: root/text-utils/parse.c
diff options
context:
space:
mode:
authorOndrej Oprala2013-09-23 15:39:36 +0200
committerKarel Zak2013-11-08 14:15:39 +0100
commit0acd3f5d0f26457ae9ea65358081b3606912875d (patch)
tree3d2c89be482f61a557a0f2ec1ab26f77a7085e48 /text-utils/parse.c
parentstrutils: add skip_space() function (diff)
downloadkernel-qcow2-util-linux-0acd3f5d0f26457ae9ea65358081b3606912875d.tar.gz
kernel-qcow2-util-linux-0acd3f5d0f26457ae9ea65358081b3606912875d.tar.xz
kernel-qcow2-util-linux-0acd3f5d0f26457ae9ea65358081b3606912875d.zip
hexdump: use skip_space() in add()
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Diffstat (limited to 'text-utils/parse.c')
-rw-r--r--text-utils/parse.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/text-utils/parse.c b/text-utils/parse.c
index 6a3a9a7ca..66200a870 100644
--- a/text-utils/parse.c
+++ b/text-utils/parse.c
@@ -96,9 +96,7 @@ void add(const char *fmt)
p = fmt;
while (TRUE) {
/* Skip leading white space. */
- while (isspace(*p) && ++p)
- ;
- if (!*p)
+ if (!*(p = skip_space(p)))
break;
/* Allocate a new format unit and link it in. */
@@ -120,14 +118,12 @@ void add(const char *fmt)
tfu->reps = atoi(savep);
tfu->flags = F_SETREP;
/* skip trailing white space */
- while (isspace(*++p))
- ;
+ p = skip_space(++p);
}
/* Skip slash and trailing white space. */
if (*p == '/')
- while (isspace(*++p))
- ;
+ p = skip_space(p);
/* byte count */
if (isdigit(*p)) {
@@ -138,8 +134,7 @@ void add(const char *fmt)
badfmt(fmt);
tfu->bcnt = atoi(savep);
/* skip trailing white space */
- while (isspace(*++p))
- ;
+ p = skip_space(++p);
}
/* format */