-
Notifications
You must be signed in to change notification settings - Fork 1
/
debug.c
executable file
·44 lines (37 loc) · 1.21 KB
/
debug.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* This file is part of the Zephir.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. If you did not receive
* a copy of the license it is available through the world-wide-web at the
* following url: https://docs.zephir-lang.com/en/latest/license
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <php.h>
#include "php_ext.h"
#include "kernel/debug.h"
#include "kernel/main.h"
#include "kernel/string.h"
#ifndef ZEPHIR_RELEASE
void zephir_vdump(zval *var, const char *func)
{
if (Z_TYPE_P(var) > IS_CALLABLE) {
fprintf(stderr, "%s: (%p) has invalid type %u\n", func, var, Z_TYPE_P(var));
}
if (!Z_REFCOUNTED_P(var)) {
fprintf(stderr, "%s: (%p) is not reference-counted, type=%d\n", func, var, Z_TYPE_P(var));
return;
}
if (Z_REFCOUNT_P(var) == 0) {
fprintf(stderr, "%s: (%p) has 0 references, type=%d\n", func, var, Z_TYPE_P(var));
} else {
if (Z_REFCOUNT_P(var) >= 1000000) {
fprintf(stderr, "%s: (%p) has too many references (%u), type=%d\n", func, var, Z_REFCOUNT_P(var), Z_TYPE_P(var));
}
}
}
#endif