[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [RFC/PATCH v3 1/8] libbb: add str_isblank() macro
From: walter harms <wharms () bfs ! de>
Date: 2015-08-25 13:09:00
Message-ID: 55DC68EC.8080102 () bfs ! de
[Download RAW message or body]
Am 25.08.2015 14:44, schrieb Denys Vlasenko:
> On Tue, Aug 25, 2015 at 1:09 PM, Bartosz Golaszewski
> <bartekgola@gmail.com> wrote:
> > Add a wrapper around skip_whitespace() which evaluates to true if given
> > string contains only whitespace characters.
> >
> > Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
> > ---
> > include/libbb.h | 2 ++
> > libbb/skip_whitespace.c | 17 +++++++++++++++++
> > 2 files changed, 19 insertions(+)
> >
> > diff --git a/include/libbb.h b/include/libbb.h
> > index 2e20706..6d7b128 100644
> > --- a/include/libbb.h
> > +++ b/include/libbb.h
> > @@ -337,6 +337,8 @@ extern char *skip_whitespace(const char *) FAST_FUNC;
> > extern char *skip_non_whitespace(const char *) FAST_FUNC;
> > extern char *skip_dev_pfx(const char *tty_name) FAST_FUNC;
> >
> > +#define str_isblank(str) (*skip_whitespace(str) == '\0')
> > +
>
> This can go into libbb when it has more than one user.
FYI:
the are some possible users
( find . -name "*.c" -exec grep -A2 -H "skip_whitespace" {} \; )
./miscutils/dc.c: token = skip_whitespace(cursor);
./miscutils/dc.c- if (*token == '\0')
./miscutils/dc.c- break;
./networking/ifupdown.c: rest_of_line = \
skip_whitespace(rest_of_line);
./networking/ifupdown.c-
./networking/ifupdown.c- if (rest_of_line[0] != '\0' /* && \
rest_of_line[0] != '#' */)
/util-linux/hexdump.c: p = skip_whitespace(buf);
./util-linux/hexdump.c- if (*p && (*p != '#')) {
./util-linux/hexdump.c- bb_dump_add(dumper, p);
./coreutils/test.c: if (p == s || *(skip_whitespace(p)) != '\0')
./coreutils/test.c- syntax(s, "bad number");
./libbb/dump.c: p = skip_whitespace(p);
./libbb/dump.c- if (*p == '\0') {
./libbb/dump.c- break;
this makes a nice TODO item
re,
wh
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic