From 6658f58d4afcb80ffaeac460564aecb1591ecd93 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Tue, 12 Nov 2013 00:50:15 -0200 Subject: [PATCH] - Added phpdbg_is_empty function --- phpdbg_prompt.c | 2 +- phpdbg_utils.c | 11 +++++++++++ phpdbg_utils.h | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 5fd07125228..b71bd3d8203 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 4991d3d9e5f..e3408ed47e7 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 231a1b3f216..3cb430f0594 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 */