2013-11-12 02:19:43 +00:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| PHP Version 5 |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Copyright (c) 1997-2013 The PHP Group |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available through the world-wide-web at the following url: |
|
|
|
|
| http://www.php.net/license/3_01.txt |
|
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Felipe Pena <felipe@php.net> |
|
|
|
|
| Authors: Joe Watkins <joe.watkins@live.co.uk> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2013-11-12 13:33:51 +00:00
|
|
|
#include <stdio.h>
|
2013-11-12 02:19:43 +00:00
|
|
|
#include <ctype.h>
|
2013-11-12 13:33:51 +00:00
|
|
|
#include "zend_alloc.h"
|
2013-11-12 02:19:43 +00:00
|
|
|
#include "phpdbg_utils.h"
|
|
|
|
|
|
|
|
int phpdbg_is_numeric(const char *str) /* {{{ */
|
|
|
|
{
|
|
|
|
for (; *str; str++) {
|
|
|
|
if (isspace(*str)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return isdigit(*str);
|
|
|
|
}
|
2013-11-12 02:28:52 +00:00
|
|
|
return 0;
|
2013-11-12 02:19:43 +00:00
|
|
|
} /* }}} */
|
2013-11-12 02:50:15 +00:00
|
|
|
|
|
|
|
int phpdbg_is_empty(const char *str) /* {{{ */
|
|
|
|
{
|
|
|
|
for (; *str; str++) {
|
|
|
|
if (isspace(*str)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
} /* }}} */
|
2013-11-12 12:58:19 +00:00
|
|
|
|
|
|
|
int phpdbg_is_addr(const char *str) /* {{{ */
|
|
|
|
{
|
|
|
|
return str[0] && str[1] && memcmp(str, "0x", 2) == 0;
|
|
|
|
} /* }}} */
|
2013-11-12 13:33:51 +00:00
|
|
|
|
|
|
|
int phpdbg_is_class_method(const char *str, size_t len, char **class, char **method) /* {{{ */
|
|
|
|
{
|
|
|
|
const char *sep = strstr(str, "::");
|
|
|
|
|
2013-11-12 13:39:02 +00:00
|
|
|
if (!sep || sep == str || sep+2 == str+len-1) {
|
2013-11-12 13:33:51 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-11-12 15:10:29 +00:00
|
|
|
*class = estrndup(str, sep - str);
|
|
|
|
class[sep - str] = 0;
|
2013-11-12 13:33:51 +00:00
|
|
|
|
2013-11-12 15:10:29 +00:00
|
|
|
*method = estrndup(sep+2, str + len - sep);
|
2013-11-12 13:33:51 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
} /* }}} */
|