[RFC/PATCH v3 1/8] libbb: add str_isblank() macro

Denys Vlasenko vda.linux at googlemail.com
Tue Aug 25 12:44:59 UTC 2015


On Tue, Aug 25, 2015 at 1:09 PM, Bartosz Golaszewski
<bartekgola at 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 at 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.


More information about the busybox mailing list