From: Felipe Pena Date: Tue, 12 Nov 2013 02:50:15 +0000 (-0200) Subject: - Added phpdbg_is_empty function X-Git-Tag: php-5.6.0alpha1~110^2~453^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6658f58d4afcb80ffaeac460564aecb1591ecd93;p=php - Added phpdbg_is_empty function --- diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 5fd0712522..b71bd3d820 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -498,7 +498,7 @@ static PHPDBG_COMMAND(quiet) { /* {{{ */ static PHPDBG_COMMAND(list) /* {{{ */ { - if (phpdbg_is_numeric(expr)) { + if (phpdbg_is_empty(expr) || phpdbg_is_numeric(expr)) { long offset = 0, count = strtol(expr, NULL, 0); const char *filename = PHPDBG_G(exec); diff --git a/phpdbg_utils.c b/phpdbg_utils.c index 4991d3d9e5..e3408ed47e 100644 --- a/phpdbg_utils.c +++ b/phpdbg_utils.c @@ -30,3 +30,14 @@ int phpdbg_is_numeric(const char *str) /* {{{ */ } return 0; } /* }}} */ + +int phpdbg_is_empty(const char *str) /* {{{ */ +{ + for (; *str; str++) { + if (isspace(*str)) { + continue; + } + return 0; + } + return 1; +} /* }}} */ diff --git a/phpdbg_utils.h b/phpdbg_utils.h index 231a1b3f21..3cb430f059 100644 --- a/phpdbg_utils.h +++ b/phpdbg_utils.h @@ -20,6 +20,7 @@ #ifndef PHPDBG_UTILS_H #define PHPDBG_UTILS_H -int phpdbg_is_numeric(const char *); +int phpdbg_is_numeric(const char*); +int phpdbg_is_empty(const char*); #endif /* PHPDBG_UTILS_H */