Coverage Report

Created: 2022-02-19 20:28

/src/php-src/Zend/zend_constants.h
Line
Count
Source
1
/*
2
   +----------------------------------------------------------------------+
3
   | Zend Engine                                                          |
4
   +----------------------------------------------------------------------+
5
   | Copyright (c) Zend Technologies Ltd. (http://www.zend.com)           |
6
   +----------------------------------------------------------------------+
7
   | This source file is subject to version 2.00 of the Zend license,     |
8
   | that is bundled with this package in the file LICENSE, and is        |
9
   | available through the world-wide-web at the following url:           |
10
   | http://www.zend.com/license/2_00.txt.                                |
11
   | If you did not receive a copy of the Zend license and are unable to  |
12
   | obtain it through the world-wide-web, please send a note to          |
13
   | license@zend.com so we can mail you a copy immediately.              |
14
   +----------------------------------------------------------------------+
15
   | Authors: Andi Gutmans <andi@php.net>                                 |
16
   |          Zeev Suraski <zeev@php.net>                                 |
17
   +----------------------------------------------------------------------+
18
*/
19
20
#ifndef ZEND_CONSTANTS_H
21
#define ZEND_CONSTANTS_H
22
23
#include "zend_globals.h"
24
25
346
#define CONST_CS        0          /* No longer used -- always case sensitive */
26
3.47M
#define CONST_PERSISTENT    (1<<0)        /* Persistent */
27
170k
#define CONST_NO_FILE_CACHE   (1<<1)        /* Can't be saved in file cache */
28
397k
#define CONST_DEPRECATED    (1<<2)        /* Deprecated */
29
30
9.95k
#define PHP_USER_CONSTANT   0x7fffff /* a constant defined in user space */
31
32
typedef struct _zend_constant {
33
  zval value;
34
  zend_string *name;
35
} zend_constant;
36
37
#define ZEND_CONSTANT_FLAGS(c) \
38
2.46M
  (Z_CONSTANT_FLAGS((c)->value) & 0xff)
39
40
#define ZEND_CONSTANT_MODULE_NUMBER(c) \
41
29.8k
  (Z_CONSTANT_FLAGS((c)->value) >> 8)
42
43
1.61M
#define ZEND_CONSTANT_SET_FLAGS(c, _flags, _module_number) do { \
44
1.59M
    Z_CONSTANT_FLAGS((c)->value) = \
45
1.59M
      ((_flags) & 0xff) | ((_module_number) << 8); \
46
1.59M
  } while (0)
47
48
#define REGISTER_NULL_CONSTANT(name, flags)  zend_register_null_constant((name), sizeof(name)-1, (flags), module_number)
49
3.00k
#define REGISTER_BOOL_CONSTANT(name, bval, flags)  zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), module_number)
50
1.22M
#define REGISTER_LONG_CONSTANT(name, lval, flags)  zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number)
51
57.1k
#define REGISTER_DOUBLE_CONSTANT(name, dval, flags)  zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), module_number)
52
60.1k
#define REGISTER_STRING_CONSTANT(name, str, flags)  zend_register_string_constant((name), sizeof(name)-1, (str), (flags), module_number)
53
#define REGISTER_STRINGL_CONSTANT(name, str, len, flags)  zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), module_number)
54
55
#define REGISTER_NS_NULL_CONSTANT(ns, name, flags)  zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (flags), module_number)
56
#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags)  zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (bval), (flags), module_number)
57
#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags)  zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
58
#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags)  zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (dval), (flags), module_number)
59
#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags)  zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (flags), module_number)
60
#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags)  zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (len), (flags), module_number)
61
62
3.00k
#define REGISTER_MAIN_NULL_CONSTANT(name, flags)  zend_register_null_constant((name), sizeof(name)-1, (flags), 0)
63
12.0k
#define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags)  zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), 0)
64
153k
#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags)  zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), 0)
65
9.02k
#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags)  zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), 0)
66
#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags)  zend_register_string_constant((name), sizeof(name)-1, (str), (flags), 0)
67
63.1k
#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags)  zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), 0)
68
69
BEGIN_EXTERN_C()
70
void clean_module_constants(int module_number);
71
void free_zend_constant(zval *zv);
72
void zend_startup_constants(void);
73
void zend_shutdown_constants(void);
74
void zend_register_standard_constants(void);
75
ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *ce);
76
ZEND_API zval *zend_get_constant(zend_string *name);
77
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len);
78
ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, uint32_t flags);
79
ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zend_bool bval, int flags, int module_number);
80
ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number);
81
ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number);
82
ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number);
83
ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number);
84
ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number);
85
ZEND_API zend_result zend_register_constant(zend_constant *c);
86
#ifdef ZTS
87
void zend_copy_constants(HashTable *target, HashTable *sourc);
88
#endif
89
90
ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t name_len);
91
92
static zend_always_inline zend_constant *zend_get_special_const(
93
537k
    const char *name, size_t name_len) {
94
537k
  if (name_len == 4 || name_len == 5) {
95
224k
    return _zend_get_special_const(name, name_len);
96
224k
  }
97
312k
  return NULL;
98
312k
}
Unexecuted instantiation: php_date.c:zend_get_special_const
Unexecuted instantiation: php_pcre.c:zend_get_special_const
Unexecuted instantiation: exif.c:zend_get_special_const
Unexecuted instantiation: hash.c:zend_get_special_const
Unexecuted instantiation: hash_md.c:zend_get_special_const
Unexecuted instantiation: hash_sha.c:zend_get_special_const
Unexecuted instantiation: hash_ripemd.c:zend_get_special_const
Unexecuted instantiation: hash_haval.c:zend_get_special_const
Unexecuted instantiation: hash_tiger.c:zend_get_special_const
Unexecuted instantiation: hash_gost.c:zend_get_special_const
Unexecuted instantiation: hash_snefru.c:zend_get_special_const
Unexecuted instantiation: hash_whirlpool.c:zend_get_special_const
Unexecuted instantiation: hash_adler32.c:zend_get_special_const
Unexecuted instantiation: hash_crc32.c:zend_get_special_const
Unexecuted instantiation: hash_fnv.c:zend_get_special_const
Unexecuted instantiation: hash_joaat.c:zend_get_special_const
Unexecuted instantiation: hash_sha3.c:zend_get_special_const
Unexecuted instantiation: json.c:zend_get_special_const
Unexecuted instantiation: json_encoder.c:zend_get_special_const
Unexecuted instantiation: json_parser.tab.c:zend_get_special_const
Unexecuted instantiation: json_scanner.c:zend_get_special_const
Unexecuted instantiation: mbstring.c:zend_get_special_const
Unexecuted instantiation: php_unicode.c:zend_get_special_const
Unexecuted instantiation: mb_gpc.c:zend_get_special_const
Unexecuted instantiation: php_mbregex.c:zend_get_special_const
Unexecuted instantiation: php_reflection.c:zend_get_special_const
Unexecuted instantiation: php_spl.c:zend_get_special_const
Unexecuted instantiation: spl_functions.c:zend_get_special_const
Unexecuted instantiation: spl_engine.c:zend_get_special_const
Unexecuted instantiation: spl_iterators.c:zend_get_special_const
Unexecuted instantiation: spl_array.c:zend_get_special_const
Unexecuted instantiation: spl_directory.c:zend_get_special_const
Unexecuted instantiation: spl_exceptions.c:zend_get_special_const
Unexecuted instantiation: spl_observer.c:zend_get_special_const
Unexecuted instantiation: spl_dllist.c:zend_get_special_const
Unexecuted instantiation: spl_heap.c:zend_get_special_const
Unexecuted instantiation: spl_fixedarray.c:zend_get_special_const
Unexecuted instantiation: crypt_sha512.c:zend_get_special_const
Unexecuted instantiation: crypt_sha256.c:zend_get_special_const
Unexecuted instantiation: php_crypt_r.c:zend_get_special_const
Unexecuted instantiation: array.c:zend_get_special_const
Unexecuted instantiation: base64.c:zend_get_special_const
Unexecuted instantiation: basic_functions.c:zend_get_special_const
Unexecuted instantiation: browscap.c:zend_get_special_const
Unexecuted instantiation: crc32.c:zend_get_special_const
Unexecuted instantiation: crypt.c:zend_get_special_const
Unexecuted instantiation: datetime.c:zend_get_special_const
Unexecuted instantiation: dir.c:zend_get_special_const
Unexecuted instantiation: dl.c:zend_get_special_const
Unexecuted instantiation: dns.c:zend_get_special_const
Unexecuted instantiation: exec.c:zend_get_special_const
Unexecuted instantiation: file.c:zend_get_special_const
Unexecuted instantiation: filestat.c:zend_get_special_const
Unexecuted instantiation: flock_compat.c:zend_get_special_const
Unexecuted instantiation: formatted_print.c:zend_get_special_const
Unexecuted instantiation: fsock.c:zend_get_special_const
Unexecuted instantiation: head.c:zend_get_special_const
Unexecuted instantiation: html.c:zend_get_special_const
Unexecuted instantiation: image.c:zend_get_special_const
Unexecuted instantiation: info.c:zend_get_special_const
Unexecuted instantiation: iptc.c:zend_get_special_const
Unexecuted instantiation: lcg.c:zend_get_special_const
Unexecuted instantiation: link.c:zend_get_special_const
Unexecuted instantiation: mail.c:zend_get_special_const
Unexecuted instantiation: math.c:zend_get_special_const
Unexecuted instantiation: md5.c:zend_get_special_const
Unexecuted instantiation: metaphone.c:zend_get_special_const
Unexecuted instantiation: microtime.c:zend_get_special_const
Unexecuted instantiation: pack.c:zend_get_special_const
Unexecuted instantiation: pageinfo.c:zend_get_special_const
Unexecuted instantiation: quot_print.c:zend_get_special_const
Unexecuted instantiation: rand.c:zend_get_special_const
Unexecuted instantiation: mt_rand.c:zend_get_special_const
Unexecuted instantiation: soundex.c:zend_get_special_const
Unexecuted instantiation: string.c:zend_get_special_const
Unexecuted instantiation: scanf.c:zend_get_special_const
Unexecuted instantiation: syslog.c:zend_get_special_const
Unexecuted instantiation: type.c:zend_get_special_const
Unexecuted instantiation: uniqid.c:zend_get_special_const
Unexecuted instantiation: url.c:zend_get_special_const
Unexecuted instantiation: var.c:zend_get_special_const
Unexecuted instantiation: versioning.c:zend_get_special_const
Unexecuted instantiation: assert.c:zend_get_special_const
Unexecuted instantiation: strnatcmp.c:zend_get_special_const
Unexecuted instantiation: levenshtein.c:zend_get_special_const
Unexecuted instantiation: incomplete_class.c:zend_get_special_const
Unexecuted instantiation: url_scanner_ex.c:zend_get_special_const
Unexecuted instantiation: ftp_fopen_wrapper.c:zend_get_special_const
Unexecuted instantiation: http_fopen_wrapper.c:zend_get_special_const
Unexecuted instantiation: php_fopen_wrapper.c:zend_get_special_const
Unexecuted instantiation: credits.c:zend_get_special_const
Unexecuted instantiation: css.c:zend_get_special_const
Unexecuted instantiation: var_unserializer.c:zend_get_special_const
Unexecuted instantiation: ftok.c:zend_get_special_const
Unexecuted instantiation: sha1.c:zend_get_special_const
Unexecuted instantiation: user_filters.c:zend_get_special_const
Unexecuted instantiation: uuencode.c:zend_get_special_const
Unexecuted instantiation: filters.c:zend_get_special_const
Unexecuted instantiation: proc_open.c:zend_get_special_const
Unexecuted instantiation: streamsfuncs.c:zend_get_special_const
Unexecuted instantiation: http.c:zend_get_special_const
Unexecuted instantiation: password.c:zend_get_special_const
Unexecuted instantiation: random.c:zend_get_special_const
Unexecuted instantiation: net.c:zend_get_special_const
Unexecuted instantiation: hrtime.c:zend_get_special_const
Unexecuted instantiation: main.c:zend_get_special_const
Unexecuted instantiation: snprintf.c:zend_get_special_const
Unexecuted instantiation: spprintf.c:zend_get_special_const
Unexecuted instantiation: fopen_wrappers.c:zend_get_special_const
Unexecuted instantiation: php_scandir.c:zend_get_special_const
Unexecuted instantiation: php_ini.c:zend_get_special_const
Unexecuted instantiation: SAPI.c:zend_get_special_const
Unexecuted instantiation: rfc1867.c:zend_get_special_const
Unexecuted instantiation: php_content_types.c:zend_get_special_const
Unexecuted instantiation: strlcpy.c:zend_get_special_const
Unexecuted instantiation: strlcat.c:zend_get_special_const
Unexecuted instantiation: explicit_bzero.c:zend_get_special_const
Unexecuted instantiation: reentrancy.c:zend_get_special_const
Unexecuted instantiation: php_variables.c:zend_get_special_const
Unexecuted instantiation: php_ticks.c:zend_get_special_const
Unexecuted instantiation: network.c:zend_get_special_const
Unexecuted instantiation: php_open_temporary_file.c:zend_get_special_const
Unexecuted instantiation: output.c:zend_get_special_const
Unexecuted instantiation: getopt.c:zend_get_special_const
Unexecuted instantiation: php_syslog.c:zend_get_special_const
Unexecuted instantiation: streams.c:zend_get_special_const
Unexecuted instantiation: cast.c:zend_get_special_const
Unexecuted instantiation: memory.c:zend_get_special_const
Unexecuted instantiation: filter.c:zend_get_special_const
Unexecuted instantiation: plain_wrapper.c:zend_get_special_const
Unexecuted instantiation: userspace.c:zend_get_special_const
Unexecuted instantiation: transports.c:zend_get_special_const
Unexecuted instantiation: xp_socket.c:zend_get_special_const
Unexecuted instantiation: mmap.c:zend_get_special_const
Unexecuted instantiation: glob_wrapper.c:zend_get_special_const
Unexecuted instantiation: zend_language_parser.c:zend_get_special_const
Unexecuted instantiation: zend_language_scanner.c:zend_get_special_const
Unexecuted instantiation: zend_ini_parser.c:zend_get_special_const
zend_compile.c:zend_get_special_const
Line
Count
Source
93
494k
    const char *name, size_t name_len) {
94
494k
  if (name_len == 4 || name_len == 5) {
95
212k
    return _zend_get_special_const(name, name_len);
96
212k
  }
97
282k
  return NULL;
98
282k
}
zend_constants.c:zend_get_special_const
Line
Count
Source
93
42.7k
    const char *name, size_t name_len) {
94
42.7k
  if (name_len == 4 || name_len == 5) {
95
12.3k
    return _zend_get_special_const(name, name_len);
96
12.3k
  }
97
30.3k
  return NULL;
98
30.3k
}
Unexecuted instantiation: zend_execute_API.c:zend_get_special_const
Unexecuted instantiation: zend_variables.c:zend_get_special_const
Unexecuted instantiation: zend.c:zend_get_special_const
Unexecuted instantiation: zend_API.c:zend_get_special_const
Unexecuted instantiation: zend_builtin_functions.c:zend_get_special_const
Unexecuted instantiation: zend_execute.c:zend_get_special_const
Unexecuted instantiation: zend_ast.c:zend_get_special_const
Unexecuted instantiation: internal_functions_cli.c:zend_get_special_const
Unexecuted instantiation: fuzzer-execute.c:zend_get_special_const
Unexecuted instantiation: fuzzer-sapi.c:zend_get_special_const
99
100
END_EXTERN_C()
101
102
#define ZEND_CONSTANT_DTOR free_zend_constant
103
104
#endif