From edbb1313a1f3f6ecae11a0d120db3c2f4c381f00 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Tue, 12 Nov 2013 13:10:29 -0200 Subject: [PATCH] - Simplify code --- phpdbg_utils.c | 10 +++------- test.php | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/phpdbg_utils.c b/phpdbg_utils.c index b509900912..4ad75acd10 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 06e855bfd3..457e487db7 100644 --- a/test.php +++ b/test.php @@ -13,6 +13,6 @@ function test2() { $my = new my(); var_dump($my->method()); -phpdbg_break(); + return true; ?> -- 2.50.1