com php-src: - Simplify code: phpdbg_utils.c test.php
| From: | Bob Weinand | Date: | Tue, 12 Nov 2013 15:10:29 +0000 |
| Subject: | com php-src: - Simplify code: phpdbg_utils.c test.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75057@lists.php.net to get a copy of this message | ||
Commit: edbb1313a1f3f6ecae11a0d120db3c2f4c381f00
Author: Felipe Pena <felipensp@gmail.com> Tue, 12 Nov 2013 13:10:29 -0200
Parents: 5a3285ae99e03ce9a7d8003dc795553cc8ef389d
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=edbb1313a1f3f6ecae11a0d120db3c2f4c381f00
Log:
- Simplify code
Changed paths:
M phpdbg_utils.c
M test.php
Diff:
diff --git a/phpdbg_utils.c b/phpdbg_utils.c
index b509900..4ad75ac 100644
--- a/phpdbg_utils.c
+++ b/phpdbg_utils.c
@@ -52,19 +52,15 @@ int phpdbg_is_addr(const char *str) /* {{{ */
int phpdbg_is_class_method(const char *str, size_t len, char **class, char **method) /* {{{ */
{
const char *sep = strstr(str, "::");
- size_t class_len, method_len;
if (!sep || sep == str || sep+2 == str+len-1) {
return 0;
}
- class_len = sep - str;
- method_len = len - ((sep+2) - str);
+ *class = estrndup(str, sep - str);
+ class[sep - str] = 0;
- *class = estrndup(str, class_len);
- class[class_len] = 0;
-
- *method = estrndup(sep+2, method_len+1);
+ *method = estrndup(sep+2, str + len - sep);
return 1;
} /* }}} */
diff --git a/test.php b/test.php
index 06e855b..457e487 100644
--- a/test.php
+++ b/test.php
@@ -13,6 +13,6 @@ function test2() {
$my = new my();
var_dump($my->method());
-phpdbg_break();
+
return true;
?>