com php-src: - Added phpdbg_is_empty function: phpdbg _prompt.c phpdbg_utils.c phpdbg_utils.h
| From: | Bob Weinand | Date: | Tue, 12 Nov 2013 02:50:15 +0000 |
| Subject: | com php-src: - Added phpdbg_is_empty function: phpdbg _prompt.c phpdbg_utils.c phpdbg_utils.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75098@lists.php.net to get a copy of this message | ||
Commit: 6658f58d4afcb80ffaeac460564aecb1591ecd93
Author: Felipe Pena <felipensp@gmail.com> Tue, 12 Nov 2013 00:50:15 -0200
Parents: 79ab9a3f74e9ecb3d9acfc4a0050b491bda56185
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6658f58d4afcb80ffaeac460564aecb1591ecd93
Log:
- Added phpdbg_is_empty function
Changed paths:
M phpdbg_prompt.c
M phpdbg_utils.c
M phpdbg_utils.h
Diff:
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 5fd0712..b71bd3d 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 4991d3d..e3408ed 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 231a1b3..3cb430f 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 */