mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
Fix [-Wundef] warnings in standard extension
This commit is contained in:
parent
62ab9293ae
commit
5171cb435a
@ -67,22 +67,22 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#include "win32/inet.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_ARPA_INET_H
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_LOADAVG_H
|
||||
#ifdef HAVE_SYS_LOADAVG_H
|
||||
# include <sys/loadavg.h>
|
||||
#endif
|
||||
|
||||
@ -91,7 +91,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE ((zend_ulong) -1)
|
||||
# define INADDR_NONE ((zend_ulong) -1)
|
||||
#endif
|
||||
|
||||
#include "zend_globals.h"
|
||||
@ -149,13 +149,13 @@ zend_module_entry basic_functions_module = { /* {{{ */
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#if defined(HAVE_PUTENV)
|
||||
#ifdef HAVE_PUTENV
|
||||
static void php_putenv_destructor(zval *zv) /* {{{ */
|
||||
{
|
||||
putenv_entry *pe = Z_PTR_P(zv);
|
||||
|
||||
if (pe->previous_value) {
|
||||
# if defined(PHP_WIN32)
|
||||
# ifdef PHP_WIN32
|
||||
/* MSVCRT has a bug in putenv() when setting a variable that
|
||||
* is already set; if the SetEnvironmentVariable() API call
|
||||
* fails, the Crt will double free() a string.
|
||||
@ -163,11 +163,11 @@ static void php_putenv_destructor(zval *zv) /* {{{ */
|
||||
SetEnvironmentVariable(ZSTR_VAL(pe->key), "bugbug");
|
||||
# endif
|
||||
putenv(pe->previous_value);
|
||||
# if defined(PHP_WIN32)
|
||||
# ifdef PHP_WIN32
|
||||
efree(pe->previous_value);
|
||||
# endif
|
||||
} else {
|
||||
# if HAVE_UNSETENV
|
||||
# ifdef HAVE_UNSETENV
|
||||
unsetenv(ZSTR_VAL(pe->key));
|
||||
# elif defined(PHP_WIN32)
|
||||
SetEnvironmentVariable(ZSTR_VAL(pe->key), NULL);
|
||||
@ -282,14 +282,14 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
|
||||
{
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor);
|
||||
#ifdef PHP_WIN32
|
||||
# ifdef PHP_WIN32
|
||||
ts_allocate_id(&php_win32_core_globals_id, sizeof(php_win32_core_globals), (ts_allocate_ctor)php_win32_core_globals_ctor, (ts_allocate_dtor)php_win32_core_globals_dtor );
|
||||
#endif
|
||||
# endif
|
||||
#else
|
||||
basic_globals_ctor(&basic_globals);
|
||||
#ifdef PHP_WIN32
|
||||
# ifdef PHP_WIN32
|
||||
php_win32_core_globals_ctor(&the_php_win32_core_globals);
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
php_ce_incomplete_class = register_class___PHP_Incomplete_Class();
|
||||
@ -347,7 +347,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
|
||||
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
#if ENABLE_TEST_CLASS
|
||||
#ifdef ENABLE_TEST_CLASS
|
||||
test_class_startup();
|
||||
#endif
|
||||
|
||||
@ -364,23 +364,23 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
|
||||
BASIC_MINIT_SUBMODULE(password)
|
||||
BASIC_MINIT_SUBMODULE(mt_rand)
|
||||
|
||||
#if defined(ZTS)
|
||||
#ifdef ZTS
|
||||
BASIC_MINIT_SUBMODULE(localeconv)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_NL_LANGINFO)
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
BASIC_MINIT_SUBMODULE(nl_langinfo)
|
||||
#endif
|
||||
|
||||
#if ZEND_INTRIN_SSE4_2_FUNC_PTR
|
||||
#ifdef ZEND_INTRIN_SSE4_2_FUNC_PTR
|
||||
BASIC_MINIT_SUBMODULE(string_intrin)
|
||||
#endif
|
||||
|
||||
#if ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR
|
||||
#ifdef ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR
|
||||
BASIC_MINIT_SUBMODULE(crc32_x86_intrin)
|
||||
#endif
|
||||
|
||||
#if ZEND_INTRIN_AVX2_FUNC_PTR || ZEND_INTRIN_SSSE3_FUNC_PTR
|
||||
#if defined(ZEND_INTRIN_AVX2_FUNC_PTR) || defined(ZEND_INTRIN_SSSE3_FUNC_PTR)
|
||||
BASIC_MINIT_SUBMODULE(base64_intrin)
|
||||
#endif
|
||||
|
||||
@ -411,8 +411,8 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
|
||||
php_register_url_stream_wrapper("http", &php_stream_http_wrapper);
|
||||
php_register_url_stream_wrapper("ftp", &php_stream_ftp_wrapper);
|
||||
|
||||
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
|
||||
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
|
||||
#if defined(PHP_WIN32) || defined(HAVE_DNS_SEARCH_FUNC)
|
||||
# if defined(PHP_WIN32) || defined(HAVE_FULL_DNS_FUNCS)
|
||||
BASIC_MINIT_SUBMODULE(dns)
|
||||
# endif
|
||||
#endif
|
||||
@ -452,7 +452,7 @@ PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
|
||||
BASIC_MSHUTDOWN_SUBMODULE(url_scanner_ex)
|
||||
BASIC_MSHUTDOWN_SUBMODULE(file)
|
||||
BASIC_MSHUTDOWN_SUBMODULE(standard_filters)
|
||||
#if defined(ZTS)
|
||||
#ifdef ZTS
|
||||
BASIC_MSHUTDOWN_SUBMODULE(localeconv)
|
||||
#endif
|
||||
BASIC_MSHUTDOWN_SUBMODULE(crypt)
|
||||
@ -876,7 +876,7 @@ PHP_FUNCTION(putenv)
|
||||
for (env = environ; env != NULL && *env != NULL; env++) {
|
||||
if (!strncmp(*env, ZSTR_VAL(pe.key), ZSTR_LEN(pe.key))
|
||||
&& (*env)[ZSTR_LEN(pe.key)] == '=') { /* found it */
|
||||
#if defined(PHP_WIN32)
|
||||
#ifdef PHP_WIN32
|
||||
/* must copy previous value because MSVCRT's putenv can free the string without notice */
|
||||
pe.previous_value = estrdup(*env);
|
||||
#else
|
||||
@ -886,7 +886,7 @@ PHP_FUNCTION(putenv)
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_UNSETENV
|
||||
#ifdef HAVE_UNSETENV
|
||||
if (!p) { /* no '=' means we want to unset it */
|
||||
unsetenv(pe.putenv_string);
|
||||
}
|
||||
@ -932,7 +932,7 @@ PHP_FUNCTION(putenv)
|
||||
}
|
||||
#endif
|
||||
tsrm_env_unlock();
|
||||
#if defined(PHP_WIN32)
|
||||
#ifdef PHP_WIN32
|
||||
free(keyw);
|
||||
free(valw);
|
||||
#endif
|
||||
@ -940,7 +940,7 @@ PHP_FUNCTION(putenv)
|
||||
} else {
|
||||
free(pe.putenv_string);
|
||||
zend_string_release(pe.key);
|
||||
#if defined(PHP_WIN32)
|
||||
#ifdef PHP_WIN32
|
||||
free(keyw);
|
||||
free(valw);
|
||||
#endif
|
||||
@ -1245,13 +1245,13 @@ PHP_FUNCTION(usleep)
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
#if HAVE_USLEEP
|
||||
#ifdef HAVE_USLEEP
|
||||
usleep((unsigned int)num);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_NANOSLEEP
|
||||
#ifdef HAVE_NANOSLEEP
|
||||
/* {{{ Delay for a number of seconds and nano seconds */
|
||||
PHP_FUNCTION(time_nanosleep)
|
||||
{
|
||||
@ -2245,7 +2245,7 @@ PHP_FUNCTION(ignore_user_abort)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_GETSERVBYNAME
|
||||
#ifdef HAVE_GETSERVBYNAME
|
||||
/* {{{ Returns port associated with service. Protocol must be "tcp" or "udp" */
|
||||
PHP_FUNCTION(getservbyname)
|
||||
{
|
||||
@ -2270,7 +2270,7 @@ PHP_FUNCTION(getservbyname)
|
||||
|
||||
serv = getservbyname(ZSTR_VAL(name), proto);
|
||||
|
||||
#if defined(_AIX)
|
||||
#ifdef _AIX
|
||||
/*
|
||||
On AIX, imap is only known as imap2 in /etc/services, while on Linux imap is an alias for imap2.
|
||||
If a request for imap gives no result, we try again with imap2.
|
||||
@ -2288,7 +2288,7 @@ PHP_FUNCTION(getservbyname)
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
#if HAVE_GETSERVBYPORT
|
||||
#ifdef HAVE_GETSERVBYPORT
|
||||
/* {{{ Returns service name associated with port. Protocol must be "tcp" or "udp" */
|
||||
PHP_FUNCTION(getservbyport)
|
||||
{
|
||||
@ -2313,7 +2313,7 @@ PHP_FUNCTION(getservbyport)
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
#if HAVE_GETPROTOBYNAME
|
||||
#ifdef HAVE_GETPROTOBYNAME
|
||||
/* {{{ Returns protocol number associated with name as per /etc/protocols */
|
||||
PHP_FUNCTION(getprotobyname)
|
||||
{
|
||||
@ -2336,7 +2336,7 @@ PHP_FUNCTION(getprotobyname)
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
#if HAVE_GETPROTOBYNUMBER
|
||||
#ifdef HAVE_GETPROTOBYNUMBER
|
||||
/* {{{ Returns protocol name associated with protocol number proto */
|
||||
PHP_FUNCTION(getprotobynumber)
|
||||
{
|
||||
|
@ -430,7 +430,7 @@ function sleep(int $seconds): int {}
|
||||
|
||||
function usleep(int $microseconds): void {}
|
||||
|
||||
#if HAVE_NANOSLEEP
|
||||
#ifdef HAVE_NANOSLEEP
|
||||
/**
|
||||
* @return array<string, int>|bool
|
||||
* @refcount 1
|
||||
@ -509,20 +509,20 @@ function connection_status(): int {}
|
||||
|
||||
function ignore_user_abort(?bool $enable = null): int {}
|
||||
|
||||
#if HAVE_GETSERVBYNAME
|
||||
#ifdef HAVE_GETSERVBYNAME
|
||||
function getservbyname(string $service, string $protocol): int|false {}
|
||||
#endif
|
||||
|
||||
#if HAVE_GETSERVBYPORT
|
||||
#ifdef HAVE_GETSERVBYPORT
|
||||
/** @refcount 1 */
|
||||
function getservbyport(int $port, string $protocol): string|false {}
|
||||
#endif
|
||||
|
||||
#if HAVE_GETPROTOBYNAME
|
||||
#ifdef HAVE_GETPROTOBYNAME
|
||||
function getprotobyname(string $protocol): int|false {}
|
||||
#endif
|
||||
|
||||
#if HAVE_GETPROTOBYNUMBER
|
||||
#ifdef HAVE_GETPROTOBYNUMBER
|
||||
/** @refcount 1 */
|
||||
function getprotobynumber(int $protocol): string|false {}
|
||||
#endif
|
||||
@ -583,7 +583,7 @@ function crypt(string $string, string $salt): string {}
|
||||
|
||||
/* datetime.c */
|
||||
|
||||
#if HAVE_STRPTIME
|
||||
#ifdef HAVE_STRPTIME
|
||||
/**
|
||||
* @return array<string, int|string>|false
|
||||
* @deprecated
|
||||
@ -611,7 +611,7 @@ function gethostbyname(string $hostname): string {}
|
||||
*/
|
||||
function gethostbynamel(string $hostname): array|false {}
|
||||
|
||||
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
|
||||
#if defined(PHP_WIN32) || defined(HAVE_DNS_SEARCH_FUNC)
|
||||
function dns_check_record(string $hostname, string $type = "MX"): bool {}
|
||||
|
||||
/** @alias dns_check_record */
|
||||
@ -647,7 +647,7 @@ function net_get_interfaces(): array|false {}
|
||||
|
||||
/* ftok.c */
|
||||
|
||||
#if HAVE_FTOK
|
||||
#ifdef HAVE_FTOK
|
||||
function ftok(string $filename, string $project_id): int {}
|
||||
#endif
|
||||
|
||||
@ -781,7 +781,7 @@ function strspn(string $string, string $characters, int $offset = 0, ?int $lengt
|
||||
|
||||
function strcspn(string $string, string $characters, int $offset = 0, ?int $length = null): int {}
|
||||
|
||||
#if HAVE_NL_LANGINFO
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
/** @refcount 1 */
|
||||
function nl_langinfo(int $item): string|false {}
|
||||
#endif
|
||||
@ -1041,7 +1041,7 @@ function closedir($dir_handle = null): void {}
|
||||
|
||||
function chdir(string $directory): bool {}
|
||||
|
||||
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
|
||||
#if defined(HAVE_CHROOT) && !defined(ZTS) && defined(ENABLE_CHROOT_FUNC)
|
||||
function chroot(string $directory): bool {}
|
||||
#endif
|
||||
|
||||
@ -1323,7 +1323,7 @@ function chown(string $filename, string|int $user): bool {}
|
||||
|
||||
function chgrp(string $filename, string|int $group): bool {}
|
||||
|
||||
#if HAVE_LCHOWN
|
||||
#ifdef HAVE_LCHOWN
|
||||
function lchown(string $filename, string|int $user): bool {}
|
||||
|
||||
function lchgrp(string $filename, string|int $group): bool {}
|
||||
@ -1331,9 +1331,8 @@ function lchgrp(string $filename, string|int $group): bool {}
|
||||
|
||||
function chmod(string $filename, int $permissions): bool {}
|
||||
|
||||
#if HAVE_UTIME
|
||||
#ifdef HAVE_UTIME
|
||||
function touch(string $filename, ?int $mtime = null, ?int $atime = null): bool {}
|
||||
#endif
|
||||
|
||||
function clearstatcache(bool $clear_realpath_cache = false, string $filename = ""): void {}
|
||||
|
||||
@ -1796,7 +1795,7 @@ function stream_socket_enable_crypto($stream, bool $enable, ?int $crypto_method
|
||||
function stream_socket_shutdown($stream, int $mode): bool {}
|
||||
#endif
|
||||
|
||||
#if HAVE_SOCKETPAIR
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
/**
|
||||
* @return array<int, resource>|false
|
||||
* @refcount 1
|
||||
@ -1888,7 +1887,7 @@ function sapi_windows_vt100_support($stream, ?bool $enable = null): bool {}
|
||||
/** @param resource $stream */
|
||||
function stream_set_chunk_size($stream, int $size): int {}
|
||||
|
||||
#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
|
||||
#if defined(HAVE_SYS_TIME_H) || defined(PHP_WIN32)
|
||||
/** @param resource $stream */
|
||||
function stream_set_timeout($stream, int $seconds, int $microseconds = 0): bool {}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@
|
||||
#include "crc32.h"
|
||||
#include "crc32_x86.h"
|
||||
|
||||
#if HAVE_AARCH64_CRC32
|
||||
#ifdef HAVE_AARCH64_CRC32
|
||||
# include <arm_acle.h>
|
||||
# if defined(__linux__)
|
||||
# include <sys/auxv.h>
|
||||
@ -91,7 +91,7 @@ static uint32_t crc32_aarch64(uint32_t crc, const char *p, size_t nr) {
|
||||
|
||||
PHPAPI uint32_t php_crc32_bulk_update(uint32_t crc, const char *p, size_t nr)
|
||||
{
|
||||
#if HAVE_AARCH64_CRC32
|
||||
#ifdef HAVE_AARCH64_CRC32
|
||||
if (has_crc32_insn()) {
|
||||
crc = crc32_aarch64(crc, p, nr);
|
||||
return crc;
|
||||
|
@ -21,14 +21,14 @@
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if PHP_USE_PHP_CRYPT_R
|
||||
# include "php_crypt_r.h"
|
||||
# include "crypt_freesec.h"
|
||||
#else
|
||||
# if HAVE_CRYPT_H
|
||||
# ifdef HAVE_CRYPT_H
|
||||
# if defined(CRYPT_R_GNU_SOURCE) && !defined(_GNU_SOURCE)
|
||||
# define _GNU_SOURCE
|
||||
# endif
|
||||
|
@ -296,7 +296,7 @@ sha512_process_bytes(const void *buffer, size_t len, struct sha512_ctx *ctx) {
|
||||
|
||||
/* Process available complete blocks. */
|
||||
if (len >= 128) {
|
||||
#if !_STRING_ARCH_unaligned
|
||||
#ifndef _STRING_ARCH_unaligned
|
||||
/* To check alignment gcc has an appropriate operator. Other
|
||||
compilers don't. */
|
||||
# if __GNUC__ >= 2
|
||||
|
@ -62,7 +62,7 @@ PHPAPI char *php_std_date(time_t t)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_STRPTIME
|
||||
#ifdef HAVE_STRPTIME
|
||||
#ifndef HAVE_STRPTIME_DECL_FAILS
|
||||
char *strptime(const char *s, const char *format, struct tm *tm);
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "basic_functions.h"
|
||||
#include "dir_arginfo.h"
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
@ -268,7 +268,7 @@ PHP_FUNCTION(closedir)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
|
||||
#if defined(HAVE_CHROOT) && !defined(ZTS) && defined(ENABLE_CHROOT_FUNC)
|
||||
/* {{{ Change root directory */
|
||||
PHP_FUNCTION(chroot)
|
||||
{
|
||||
@ -342,9 +342,9 @@ PHP_FUNCTION(getcwd)
|
||||
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
#if HAVE_GETCWD
|
||||
#ifdef HAVE_GETCWD
|
||||
ret = VCWD_GETCWD(path, MAXPATHLEN);
|
||||
#elif HAVE_GETWD
|
||||
#elif defined(HAVE_GETWD)
|
||||
ret = VCWD_GETWD(path);
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "SAPI.h"
|
||||
|
||||
#if defined(HAVE_LIBDL)
|
||||
#ifdef HAVE_LIBDL
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -65,7 +65,7 @@ PHPAPI PHP_FUNCTION(dl)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if defined(HAVE_LIBDL)
|
||||
#ifdef HAVE_LIBDL
|
||||
|
||||
/* {{{ php_load_shlib */
|
||||
PHPAPI void *php_load_shlib(const char *path, char **errp)
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "php.h"
|
||||
#include "php_network.h"
|
||||
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
# include <Ws2tcpip.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#if HAVE_ARPA_INET_H
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
@ -39,13 +39,13 @@
|
||||
#undef STATUS
|
||||
#undef T_UNSPEC
|
||||
#endif
|
||||
#if HAVE_ARPA_NAMESER_H
|
||||
#ifdef HAVE_ARPA_NAMESER_H
|
||||
#ifdef DARWIN
|
||||
# define BIND_8_COMPAT 1
|
||||
#endif
|
||||
#include <arpa/nameser.h>
|
||||
#endif
|
||||
#if HAVE_RESOLV_H
|
||||
#ifdef HAVE_RESOLV_H
|
||||
#include <resolv.h>
|
||||
#if defined(__HAIKU__)
|
||||
extern void __res_ndestroy(res_state statp);
|
||||
@ -157,7 +157,7 @@ PHP_FUNCTION(gethostbyaddr)
|
||||
hostname = php_gethostbyaddr(addr);
|
||||
|
||||
if (hostname == NULL) {
|
||||
#if HAVE_IPV6 && HAVE_INET_PTON
|
||||
#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
|
||||
php_error_docref(NULL, E_WARNING, "Address is not a valid IPv4 or IPv6 address");
|
||||
#else
|
||||
php_error_docref(NULL, E_WARNING, "Address is not in a.b.c.d form");
|
||||
@ -172,7 +172,7 @@ PHP_FUNCTION(gethostbyaddr)
|
||||
/* {{{ php_gethostbyaddr */
|
||||
static zend_string *php_gethostbyaddr(char *ip)
|
||||
{
|
||||
#if HAVE_IPV6 && HAVE_INET_PTON
|
||||
#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
|
||||
struct sockaddr_in sa4;
|
||||
struct sockaddr_in6 sa6;
|
||||
char out[NI_MAXHOST];
|
||||
@ -316,7 +316,7 @@ static zend_string *php_gethostbyname(char *name)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32)
|
||||
#if defined(HAVE_FULL_DNS_FUNCS) || defined(PHP_WIN32)
|
||||
# define PHP_DNS_NUM_TYPES 13 /* Number of DNS Types Supported by PHP currently */
|
||||
|
||||
# define PHP_DNS_A 0x00000001
|
||||
@ -337,7 +337,7 @@ static zend_string *php_gethostbyname(char *name)
|
||||
#endif /* HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) */
|
||||
|
||||
/* Note: These functions are defined in ext/standard/dns_win32.c for Windows! */
|
||||
#if !defined(PHP_WIN32) && HAVE_DNS_SEARCH_FUNC
|
||||
#if !defined(PHP_WIN32) && defined(HAVE_DNS_SEARCH_FUNC)
|
||||
|
||||
#ifndef HFIXEDSZ
|
||||
#define HFIXEDSZ 12 /* fixed data in header <arpa/nameser.h> */
|
||||
@ -454,7 +454,7 @@ PHP_FUNCTION(dns_check_record)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_FULL_DNS_FUNCS
|
||||
#ifdef HAVE_FULL_DNS_FUNCS
|
||||
|
||||
#define CHECKCP(n) do { \
|
||||
if (cp + n > end) { \
|
||||
@ -1162,7 +1162,7 @@ PHP_FUNCTION(dns_get_mx)
|
||||
#endif /* HAVE_FULL_DNS_FUNCS */
|
||||
#endif /* !defined(PHP_WIN32) && HAVE_DNS_SEARCH_FUNC */
|
||||
|
||||
#if HAVE_FULL_DNS_FUNCS && !defined(PHP_WIN32)
|
||||
#if defined(HAVE_FULL_DNS_FUNCS) && !defined(PHP_WIN32)
|
||||
PHP_MINIT_FUNCTION(dns) {
|
||||
REGISTER_LONG_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT);
|
||||
|
@ -26,23 +26,23 @@
|
||||
#include "php_globals.h"
|
||||
#include "SAPI.h"
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if HAVE_SYS_STAT_H
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#if HAVE_FCNTL_H
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include "php_string.h"
|
||||
#include "file.h"
|
||||
|
||||
#if HAVE_PWD_H
|
||||
#ifdef HAVE_PWD_H
|
||||
# ifdef PHP_WIN32
|
||||
# include "win32/pwd.h"
|
||||
# else
|
||||
@ -246,7 +246,7 @@ PHP_MINIT_FUNCTION(file)
|
||||
REGISTER_LONG_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
|
||||
#if HAVE_IPV6
|
||||
#ifdef HAVE_IPV6
|
||||
# ifdef PF_INET6
|
||||
REGISTER_LONG_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT);
|
||||
# elif defined(AF_INET6)
|
||||
|
@ -96,7 +96,7 @@ typedef struct {
|
||||
HashTable *stream_filters; /* per-request copy of stream_filters_hash */
|
||||
HashTable *wrapper_errors; /* key: wrapper address; value: linked list of char* */
|
||||
int pclose_wait;
|
||||
#if defined(HAVE_GETHOSTBYNAME_R)
|
||||
#ifdef HAVE_GETHOSTBYNAME_R
|
||||
struct hostent tmp_host_info;
|
||||
char *tmp_host_buf;
|
||||
size_t tmp_host_buf_len;
|
||||
|
@ -25,15 +25,15 @@
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_VFS_H
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
# include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_PWD_H
|
||||
#ifdef HAVE_PWD_H
|
||||
# ifdef PHP_WIN32
|
||||
# include "win32/pwd.h"
|
||||
# else
|
||||
@ -72,7 +72,7 @@
|
||||
# include <grp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UTIME
|
||||
#ifdef HAVE_UTIME
|
||||
# ifdef PHP_WIN32
|
||||
# include <sys/utime.h>
|
||||
# else
|
||||
@ -373,7 +373,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
#if !defined(WINDOWS)
|
||||
#ifndef WINDOWS
|
||||
/* On Windows, we expect regular chgrp to fail silently by default */
|
||||
php_error_docref(NULL, E_WARNING, "Cannot call chgrp() for a non-standard stream");
|
||||
#endif
|
||||
@ -381,7 +381,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#ifdef WINDOWS
|
||||
/* We have no native chgrp on Windows, nothing left to do if stream doesn't have own implementation */
|
||||
RETURN_FALSE;
|
||||
#else
|
||||
@ -400,7 +400,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
|
||||
}
|
||||
|
||||
if (do_lchgrp) {
|
||||
#if HAVE_LCHOWN
|
||||
#ifdef HAVE_LCHOWN
|
||||
ret = VCWD_LCHOWN(filename, -1, gid);
|
||||
#endif
|
||||
} else {
|
||||
@ -423,7 +423,7 @@ PHP_FUNCTION(chgrp)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Change symlink group */
|
||||
#if HAVE_LCHOWN
|
||||
#ifdef HAVE_LCHOWN
|
||||
PHP_FUNCTION(lchgrp)
|
||||
{
|
||||
php_do_chgrp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
||||
@ -499,7 +499,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
#if !defined(WINDOWS)
|
||||
#ifndef WINDOWS
|
||||
/* On Windows, we expect regular chown to fail silently by default */
|
||||
php_error_docref(NULL, E_WARNING, "Cannot call chown() for a non-standard stream");
|
||||
#endif
|
||||
@ -507,7 +507,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#ifdef WINDOWS
|
||||
/* We have no native chown on Windows, nothing left to do if stream doesn't have own implementation */
|
||||
RETURN_FALSE;
|
||||
#else
|
||||
@ -527,7 +527,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
|
||||
}
|
||||
|
||||
if (do_lchown) {
|
||||
#if HAVE_LCHOWN
|
||||
#ifdef HAVE_LCHOWN
|
||||
ret = VCWD_LCHOWN(filename, uid, -1);
|
||||
#endif
|
||||
} else {
|
||||
@ -551,7 +551,7 @@ PHP_FUNCTION(chown)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Change file owner */
|
||||
#if HAVE_LCHOWN
|
||||
#ifdef HAVE_LCHOWN
|
||||
PHP_FUNCTION(lchown)
|
||||
{
|
||||
RETVAL_TRUE;
|
||||
@ -605,7 +605,7 @@ PHP_FUNCTION(chmod)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_UTIME
|
||||
#ifdef HAVE_UTIME
|
||||
/* {{{ Set modification time of file */
|
||||
PHP_FUNCTION(touch)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ PHPAPI int flock(int fd, int operation)
|
||||
#endif /* !defined(HAVE_FLOCK) */
|
||||
|
||||
PHPAPI int php_flock(int fd, int operation)
|
||||
#if HAVE_STRUCT_FLOCK /* {{{ */
|
||||
#ifdef HAVE_STRUCT_FLOCK /* {{{ */
|
||||
{
|
||||
struct flock flck;
|
||||
int ret;
|
||||
@ -151,7 +151,7 @@ PHPAPI int php_flock(int fd, int operation)
|
||||
#endif
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
#if !(HAVE_INET_ATON)
|
||||
#ifndef HAVE_INET_ATON
|
||||
/* {{{ inet_aton
|
||||
* Check whether "cp" is a valid ascii representation
|
||||
* of an Internet address and convert to a binary address.
|
||||
|
@ -17,7 +17,7 @@
|
||||
#ifndef FLOCK_COMPAT_H
|
||||
#define FLOCK_COMPAT_H
|
||||
|
||||
#if HAVE_STRUCT_FLOCK
|
||||
#ifdef HAVE_STRUCT_FLOCK
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/file.h>
|
||||
@ -57,17 +57,16 @@ PHPAPI int flock(int fd, int operation);
|
||||
# define ftruncate(a, b) chsize(a, b)
|
||||
#endif /* defined(PHP_WIN32) */
|
||||
|
||||
#if !HAVE_INET_ATON
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#if HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
#ifndef HAVE_INET_ATON
|
||||
# ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
# endif
|
||||
# ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
# endif
|
||||
# ifndef PHP_WIN32
|
||||
extern int inet_aton(const char *, struct in_addr *);
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* FLOCK_COMPAT_H */
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "win32/ipc.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_FTOK
|
||||
#ifdef HAVE_FTOK
|
||||
/* {{{ Convert a pathname and a project identifier to a System V IPC key */
|
||||
PHP_FUNCTION(ftok)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "php_standard.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#if HAVE_ARPA_INET_H
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#endif
|
||||
|
@ -134,7 +134,7 @@ static zend_always_inline php_hrtime_t _timer_current(void)
|
||||
#endif
|
||||
}/*}}}*/
|
||||
|
||||
#if ZEND_ENABLE_ZVAL_LONG64
|
||||
#ifdef ZEND_ENABLE_ZVAL_LONG64
|
||||
#define PHP_RETURN_HRTIME(t) RETURN_LONG((zend_long)t)
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "php_string.h"
|
||||
#include "SAPI.h"
|
||||
#include <locale.h>
|
||||
#if HAVE_LANGINFO_H
|
||||
#ifdef HAVE_LANGINFO_H
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "php_standard.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#if HAVE_ARPA_INET_H
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#endif
|
||||
|
@ -17,18 +17,18 @@
|
||||
|
||||
#include "php.h"
|
||||
#include <stdio.h>
|
||||
#if HAVE_FCNTL_H
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include "fopen_wrappers.h"
|
||||
#include "ext/standard/fsock.h"
|
||||
#include "libavifinfo/avifinfo.h"
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "php_image.h"
|
||||
|
||||
#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
|
||||
#if defined(HAVE_ZLIB) && !defined(COMPILE_DL_ZLIB)
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
@ -80,7 +80,7 @@ PHP_MINIT_FUNCTION(imagetypes)
|
||||
REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT);
|
||||
#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
|
||||
#if defined(HAVE_ZLIB) && !defined(COMPILE_DL_ZLIB)
|
||||
REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT);
|
||||
@ -188,7 +188,7 @@ static unsigned long int php_swf_get_bits (unsigned char* buffer, unsigned int p
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
|
||||
#if defined(HAVE_ZLIB) && !defined(COMPILE_DL_ZLIB)
|
||||
/* {{{ php_handle_swc */
|
||||
static struct gfxinfo *php_handle_swc(php_stream * stream)
|
||||
{
|
||||
@ -619,7 +619,7 @@ static struct gfxinfo *php_handle_jpc(php_stream * stream)
|
||||
result->width = php_read4(stream); /* Xsiz */
|
||||
result->height = php_read4(stream); /* Ysiz */
|
||||
|
||||
#if MBO_0
|
||||
#ifdef MBO_0
|
||||
php_read4(stream); /* XOsiz */
|
||||
php_read4(stream); /* YOsiz */
|
||||
php_read4(stream); /* XTsiz */
|
||||
@ -1486,7 +1486,7 @@ static void php_getimagesize_from_stream(php_stream *stream, char *input, zval *
|
||||
result = php_handle_swf(stream);
|
||||
break;
|
||||
case IMAGE_FILETYPE_SWC:
|
||||
#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
|
||||
#if defined(HAVE_ZLIB) && !defined(COMPILE_DL_ZLIB)
|
||||
result = php_handle_swc(stream);
|
||||
#else
|
||||
php_error_docref(NULL, E_NOTICE, "The image is a compressed SWF file, but you do not have a static version of the zlib extension enabled");
|
||||
|
@ -893,13 +893,13 @@ PHPAPI ZEND_COLD void php_print_info(int flag)
|
||||
efree(descr);
|
||||
}
|
||||
|
||||
#if HAVE_IPV6
|
||||
#ifdef HAVE_IPV6
|
||||
php_info_print_table_row(2, "IPv6 Support", "enabled" );
|
||||
#else
|
||||
php_info_print_table_row(2, "IPv6 Support", "disabled" );
|
||||
#endif
|
||||
|
||||
#if HAVE_DTRACE
|
||||
#ifdef HAVE_DTRACE
|
||||
php_info_print_table_row(2, "DTrace Support", (zend_dtrace_enabled ? "enabled" : "available, disabled"));
|
||||
#else
|
||||
php_info_print_table_row(2, "DTrace Support", "disabled" );
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "php.h"
|
||||
#include "php_lcg.h"
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -25,14 +25,14 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifndef PHP_WIN32
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#if HAVE_PWD_H
|
||||
#ifdef HAVE_PWD_H
|
||||
#ifdef PHP_WIN32
|
||||
#include "win32/pwd.h"
|
||||
#else
|
||||
|
@ -25,15 +25,15 @@
|
||||
#include "ext/date/php_date.h"
|
||||
#include "zend_smart_str.h"
|
||||
|
||||
#if HAVE_SYSEXITS_H
|
||||
#include <sysexits.h>
|
||||
#ifdef HAVE_SYSEXITS_H
|
||||
# include <sysexits.h>
|
||||
#endif
|
||||
#if HAVE_SYS_SYSEXITS_H
|
||||
#include <sys/sysexits.h>
|
||||
#ifdef HAVE_SYS_SYSEXITS_H
|
||||
# include <sys/sysexits.h>
|
||||
#endif
|
||||
|
||||
#if PHP_SIGCHILD
|
||||
#include <signal.h>
|
||||
# include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "php_syslog.h"
|
||||
@ -43,7 +43,7 @@
|
||||
#include "exec.h"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#include "win32/sendmail.h"
|
||||
# include "win32/sendmail.h"
|
||||
#endif
|
||||
|
||||
#define SKIP_LONG_HEADER_SEP(str, pos) \
|
||||
|
@ -17,15 +17,15 @@
|
||||
#include "php.h"
|
||||
#include "php_network.h"
|
||||
|
||||
#if HAVE_ARPA_INET_H
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_NET_IF_H
|
||||
#ifdef HAVE_NET_IF_H
|
||||
# include <net/if.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_GETIFADDRS
|
||||
#ifdef HAVE_GETIFADDRS
|
||||
# include <ifaddrs.h>
|
||||
#elif defined(__PASE__)
|
||||
/* IBM i implements getifaddrs, but under its own name */
|
||||
@ -53,7 +53,7 @@ PHPAPI zend_string* php_inet_ntop(const struct sockaddr *addr) {
|
||||
if (!addr) { return NULL; }
|
||||
|
||||
/* Prefer inet_ntop() as it's more task-specific and doesn't have to be demangled */
|
||||
#if HAVE_INET_NTOP
|
||||
#ifdef HAVE_INET_NTOP
|
||||
switch (addr->sa_family) {
|
||||
#ifdef AF_INET6
|
||||
case AF_INET6: {
|
||||
@ -102,7 +102,7 @@ PHPAPI zend_string* php_inet_ntop(const struct sockaddr *addr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(PHP_WIN32) || HAVE_GETIFADDRS || defined(__PASE__)
|
||||
#if defined(PHP_WIN32) || defined(HAVE_GETIFADDRS) || defined(__PASE__)
|
||||
static void iface_append_unicast(zval *unicast, zend_long flags,
|
||||
struct sockaddr *addr, struct sockaddr *netmask,
|
||||
struct sockaddr *broadcast, struct sockaddr *ptp) {
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "ext/standard/head.h"
|
||||
#include "php_string.h"
|
||||
#include "pack.h"
|
||||
#if HAVE_PWD_H
|
||||
#ifdef HAVE_PWD_H
|
||||
#ifdef PHP_WIN32
|
||||
#include "win32/pwd.h"
|
||||
#else
|
||||
@ -39,7 +39,7 @@
|
||||
#endif
|
||||
#endif
|
||||
#include "fsock.h"
|
||||
#if HAVE_NETINET_IN_H
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_PWD_H
|
||||
#ifdef HAVE_PWD_H
|
||||
#ifdef PHP_WIN32
|
||||
#include "win32/pwd.h"
|
||||
#else
|
||||
@ -36,7 +36,7 @@
|
||||
#define getgid() 1
|
||||
#define getuid() 1
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "zend_interfaces.h"
|
||||
#include "info.h"
|
||||
#include "php_random.h"
|
||||
#if HAVE_ARGON2LIB
|
||||
#ifdef HAVE_ARGON2LIB
|
||||
#include "argon2.h"
|
||||
#endif
|
||||
|
||||
@ -231,7 +231,7 @@ const php_password_algo php_password_algo_bcrypt = {
|
||||
};
|
||||
|
||||
|
||||
#if HAVE_ARGON2LIB
|
||||
#ifdef HAVE_ARGON2LIB
|
||||
/* argon2i/argon2id shared implementation */
|
||||
|
||||
static int extract_argon2_parameters(const zend_string *hash,
|
||||
@ -427,7 +427,7 @@ PHP_MINIT_FUNCTION(password) /* {{{ */
|
||||
}
|
||||
REGISTER_STRING_CONSTANT("PASSWORD_BCRYPT", "2y", CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
#if HAVE_ARGON2LIB
|
||||
#ifdef HAVE_ARGON2LIB
|
||||
if (FAILURE == php_password_algo_register("argon2i", &php_password_algo_argon2i)) {
|
||||
return FAILURE;
|
||||
}
|
||||
@ -440,7 +440,7 @@ PHP_MINIT_FUNCTION(password) /* {{{ */
|
||||
#endif
|
||||
|
||||
REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT);
|
||||
#if HAVE_ARGON2LIB
|
||||
#ifdef HAVE_ARGON2LIB
|
||||
REGISTER_LONG_CONSTANT("PASSWORD_ARGON2_DEFAULT_MEMORY_COST", PHP_PASSWORD_ARGON2_MEMORY_COST, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PASSWORD_ARGON2_DEFAULT_TIME_COST", PHP_PASSWORD_ARGON2_TIME_COST, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PASSWORD_ARGON2_DEFAULT_THREADS", PHP_PASSWORD_ARGON2_THREADS, CONST_CS | CONST_PERSISTENT);
|
||||
@ -495,7 +495,7 @@ static const php_password_algo* php_password_algo_find_zval(zend_string *arg_str
|
||||
switch (arg_long) {
|
||||
case 0: return php_password_algo_default();
|
||||
case 1: return &php_password_algo_bcrypt;
|
||||
#if HAVE_ARGON2LIB
|
||||
#ifdef HAVE_ARGON2LIB
|
||||
case 2: return &php_password_algo_argon2i;
|
||||
case 3: return &php_password_algo_argon2id;
|
||||
#else
|
||||
|
@ -29,7 +29,7 @@
|
||||
#elif defined(HAVE_RES_NSEARCH)
|
||||
#define php_dns_search(res, dname, class, type, answer, anslen) \
|
||||
res_nsearch(res, dname, class, type, answer, anslen);
|
||||
#if HAVE_RES_NDESTROY
|
||||
#ifdef HAVE_RES_NDESTROY
|
||||
#define php_dns_free_handle(res) \
|
||||
res_ndestroy(res); \
|
||||
php_dns_free_res(res)
|
||||
@ -52,12 +52,12 @@
|
||||
#define HAVE_DNS_SEARCH_FUNC 1
|
||||
#endif
|
||||
|
||||
#if HAVE_DNS_SEARCH_FUNC && HAVE_DN_EXPAND && HAVE_DN_SKIPNAME
|
||||
#if defined(HAVE_DNS_SEARCH_FUNC) && defined(HAVE_DN_EXPAND) && defined(HAVE_DN_SKIPNAME)
|
||||
#define HAVE_FULL_DNS_FUNCS 1
|
||||
#endif
|
||||
|
||||
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
|
||||
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
|
||||
#if defined(PHP_WIN32) || defined(HAVE_DNS_SEARCH_FUNC)
|
||||
# if defined(PHP_WIN32) || defined(HAVE_FULL_DNS_FUNCS)
|
||||
PHP_MINIT_FUNCTION(dns);
|
||||
# endif
|
||||
#endif /* defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC */
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
@ -317,7 +317,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
dtablesize = getdtablesize();
|
||||
#else
|
||||
dtablesize = INT_MAX;
|
||||
|
@ -24,7 +24,7 @@ PHP_MSHUTDOWN_FUNCTION(password);
|
||||
#define PHP_PASSWORD_DEFAULT PHP_PASSWORD_BCRYPT
|
||||
#define PHP_PASSWORD_BCRYPT_COST 10
|
||||
|
||||
#if HAVE_ARGON2LIB
|
||||
#ifdef HAVE_ARGON2LIB
|
||||
/**
|
||||
* When updating these values, synchronize ext/sodium/sodium_pwhash.c values.
|
||||
* Note that libargon expresses memlimit in KB, while libsoidum uses bytes.
|
||||
@ -44,7 +44,7 @@ typedef struct _php_password_algo {
|
||||
} php_password_algo;
|
||||
|
||||
extern const php_password_algo php_password_algo_bcrypt;
|
||||
#if HAVE_ARGON2LIB
|
||||
#ifdef HAVE_ARGON2LIB
|
||||
extern const php_password_algo php_password_algo_argon2i;
|
||||
extern const php_password_algo php_password_algo_argon2id;
|
||||
#endif
|
||||
|
@ -18,14 +18,14 @@
|
||||
#ifndef PHP_STRING_H
|
||||
#define PHP_STRING_H
|
||||
|
||||
#if defined(ZTS)
|
||||
#ifdef ZTS
|
||||
PHP_MINIT_FUNCTION(localeconv);
|
||||
PHP_MSHUTDOWN_FUNCTION(localeconv);
|
||||
#endif
|
||||
#if HAVE_NL_LANGINFO
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
PHP_MINIT_FUNCTION(nl_langinfo);
|
||||
#endif
|
||||
#if ZEND_INTRIN_SSE4_2_FUNC_PTR
|
||||
#ifdef ZEND_INTRIN_SSE4_2_FUNC_PTR
|
||||
PHP_MINIT_FUNCTION(string_intrin);
|
||||
#endif
|
||||
|
||||
@ -59,7 +59,7 @@ PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return
|
||||
PHPAPI size_t php_strspn(const char *s1, const char *s2, const char *s1_end, const char *s2_end);
|
||||
PHPAPI size_t php_strcspn(const char *s1, const char *s2, const char *s1_end, const char *s2_end);
|
||||
|
||||
#if defined(_REENTRANT)
|
||||
#ifdef _REENTRANT
|
||||
# ifdef PHP_WIN32
|
||||
# include <wchar.h>
|
||||
# endif
|
||||
|
@ -28,11 +28,11 @@
|
||||
#include "main/php_network.h"
|
||||
#include "zend_smart_str.h"
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_FCNTL_H
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
@ -42,8 +42,8 @@
|
||||
* around the alternate code. */
|
||||
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
|
||||
|
||||
#if HAVE_OPENPTY
|
||||
# if HAVE_PTY_H
|
||||
#ifdef HAVE_OPENPTY
|
||||
# ifdef HAVE_PTY_H
|
||||
# include <pty.h>
|
||||
# elif defined(__FreeBSD__)
|
||||
/* FreeBSD defines `openpty` in <libutil.h> */
|
||||
@ -680,7 +680,7 @@ static zend_result set_proc_descriptor_to_blackhole(descriptorspec_item *desc)
|
||||
|
||||
static zend_result set_proc_descriptor_to_pty(descriptorspec_item *desc, int *master_fd, int *slave_fd)
|
||||
{
|
||||
#if HAVE_OPENPTY
|
||||
#ifdef HAVE_OPENPTY
|
||||
/* All FDs set to PTY in the child process will go to the slave end of the same PTY.
|
||||
* Likewise, all the corresponding entries in `$pipes` in the parent will all go to the master
|
||||
* end of the same PTY.
|
||||
@ -1318,7 +1318,7 @@ exit_fail:
|
||||
#else
|
||||
efree_argv(argv);
|
||||
#endif
|
||||
#if HAVE_OPENPTY
|
||||
#ifdef HAVE_OPENPTY
|
||||
if (pty_master_fd != -1) {
|
||||
close(pty_master_fd);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, bool should_throw)
|
||||
struct stat st;
|
||||
|
||||
if (fd < 0) {
|
||||
#if HAVE_DEV_URANDOM
|
||||
#ifdef HAVE_DEV_URANDOM
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
#endif
|
||||
if (fd < 0) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "streamsfuncs.h"
|
||||
#include "php_network.h"
|
||||
#include "php_string.h"
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
@ -46,7 +46,7 @@ static php_stream_context *decode_context_param(zval *contextresource);
|
||||
|
||||
/* Streams based network functions */
|
||||
|
||||
#if HAVE_SOCKETPAIR
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
/* {{{ Creates a pair of connected, indistinguishable socket streams */
|
||||
PHP_FUNCTION(stream_socket_pair)
|
||||
{
|
||||
@ -1343,7 +1343,7 @@ PHP_FUNCTION(stream_set_blocking)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Set timeout on stream read to seconds + microseonds */
|
||||
#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
|
||||
#if defined(HAVE_SYS_TIME_H) || defined(PHP_WIN32)
|
||||
PHP_FUNCTION(stream_set_timeout)
|
||||
{
|
||||
zval *socket;
|
||||
|
@ -320,7 +320,7 @@ PHP_FUNCTION(strcspn)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION(nl_langinfo) */
|
||||
#if HAVE_NL_LANGINFO
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
PHP_MINIT_FUNCTION(nl_langinfo)
|
||||
{
|
||||
#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
|
||||
@ -1429,7 +1429,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, const char *suffix,
|
||||
|
||||
/* Strip trailing slashes */
|
||||
while (basename_end >= s
|
||||
#if defined(PHP_WIN32)
|
||||
#ifdef PHP_WIN32
|
||||
&& (*basename_end == '/'
|
||||
|| *basename_end == '\\'
|
||||
|| (*basename_end == ':'
|
||||
@ -1447,7 +1447,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, const char *suffix,
|
||||
basename_start = basename_end;
|
||||
basename_end++;
|
||||
while (basename_start > s
|
||||
#if defined(PHP_WIN32)
|
||||
#ifdef PHP_WIN32
|
||||
&& *(basename_start-1) != '/'
|
||||
&& *(basename_start-1) != '\\') {
|
||||
|
||||
@ -1474,7 +1474,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, const char *suffix,
|
||||
case 0:
|
||||
goto quit_loop;
|
||||
case 1:
|
||||
#if defined(PHP_WIN32)
|
||||
#ifdef PHP_WIN32
|
||||
if (*s == '/' || *s == '\\') {
|
||||
#else
|
||||
if (*s == '/') {
|
||||
@ -1483,7 +1483,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, const char *suffix,
|
||||
state = 0;
|
||||
basename_end = s;
|
||||
}
|
||||
#if defined(PHP_WIN32)
|
||||
#ifdef PHP_WIN32
|
||||
/* Catch relative paths in c:file.txt style. They're not to confuse
|
||||
with the NTFS streams. This part ensures also, that no drive
|
||||
letter traversing happens. */
|
||||
@ -3344,7 +3344,7 @@ PHP_FUNCTION(strtr)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Reverse a string */
|
||||
#if ZEND_INTRIN_SSSE3_NATIVE
|
||||
#ifdef ZEND_INTRIN_SSSE3_NATIVE
|
||||
#include <tmmintrin.h>
|
||||
#elif defined(__aarch64__)
|
||||
#include <arm_neon.h>
|
||||
@ -3366,7 +3366,7 @@ PHP_FUNCTION(strrev)
|
||||
s = ZSTR_VAL(str);
|
||||
e = s + ZSTR_LEN(str);
|
||||
--e;
|
||||
#if ZEND_INTRIN_SSSE3_NATIVE
|
||||
#ifdef ZEND_INTRIN_SSSE3_NATIVE
|
||||
if (e - s > 15) {
|
||||
const __m128i map = _mm_set_epi8(
|
||||
0, 1, 2, 3,
|
||||
@ -3664,10 +3664,10 @@ PHPAPI zend_string *php_addcslashes(zend_string *str, const char *what, size_t w
|
||||
|
||||
/* {{{ php_addslashes */
|
||||
|
||||
#if ZEND_INTRIN_SSE4_2_NATIVE
|
||||
#ifdef ZEND_INTRIN_SSE4_2_NATIVE
|
||||
# include <nmmintrin.h>
|
||||
# include "Zend/zend_bitset.h"
|
||||
#elif ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
#elif defined(ZEND_INTRIN_SSE4_2_RESOLVER)
|
||||
# include <nmmintrin.h>
|
||||
# include "Zend/zend_bitset.h"
|
||||
# include "Zend/zend_cpuinfo.h"
|
||||
@ -3678,7 +3678,7 @@ zend_string *php_addslashes_default(zend_string *str);
|
||||
ZEND_INTRIN_SSE4_2_FUNC_DECL(void php_stripslashes_sse42(zend_string *str));
|
||||
void php_stripslashes_default(zend_string *str);
|
||||
|
||||
# if ZEND_INTRIN_SSE4_2_FUNC_PROTO
|
||||
# ifdef ZEND_INTRIN_SSE4_2_FUNC_PROTO
|
||||
PHPAPI zend_string *php_addslashes(zend_string *str) __attribute__((ifunc("resolve_addslashes")));
|
||||
PHPAPI void php_stripslashes(zend_string *str) __attribute__((ifunc("resolve_stripslashes")));
|
||||
|
||||
@ -3730,10 +3730,10 @@ PHP_MINIT_FUNCTION(string_intrin)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if ZEND_INTRIN_SSE4_2_NATIVE || ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
# if ZEND_INTRIN_SSE4_2_NATIVE
|
||||
#if defined(ZEND_INTRIN_SSE4_2_NATIVE) || defined(ZEND_INTRIN_SSE4_2_RESOLVER)
|
||||
# ifdef ZEND_INTRIN_SSE4_2_NATIVE
|
||||
PHPAPI zend_string *php_addslashes(zend_string *str) /* {{{ */
|
||||
# elif ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
# elif defined(ZEND_INTRIN_SSE4_2_RESOLVER)
|
||||
zend_string *php_addslashes_sse42(zend_string *str)
|
||||
# endif
|
||||
{
|
||||
@ -3910,8 +3910,8 @@ static zend_always_inline char *aarch64_add_slashes(quad_word res, const char *s
|
||||
}
|
||||
#endif /* __aarch64__ */
|
||||
|
||||
#if !ZEND_INTRIN_SSE4_2_NATIVE
|
||||
# if ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
#ifndef ZEND_INTRIN_SSE4_2_NATIVE
|
||||
# ifdef ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
zend_string *php_addslashes_default(zend_string *str) /* {{{ */
|
||||
# else
|
||||
PHPAPI zend_string *php_addslashes(zend_string *str)
|
||||
@ -4072,10 +4072,10 @@ static zend_always_inline char *php_stripslashes_impl(const char *str, char *out
|
||||
return out;
|
||||
}
|
||||
|
||||
#if ZEND_INTRIN_SSE4_2_NATIVE || ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
# if ZEND_INTRIN_SSE4_2_NATIVE
|
||||
#if defined(ZEND_INTRIN_SSE4_2_NATIVE) || defined(ZEND_INTRIN_SSE4_2_RESOLVER)
|
||||
# ifdef ZEND_INTRIN_SSE4_2_NATIVE
|
||||
PHPAPI void php_stripslashes(zend_string *str)
|
||||
# elif ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
# elif defined(ZEND_INTRIN_SSE4_2_RESOLVER)
|
||||
void php_stripslashes_sse42(zend_string *str)
|
||||
# endif
|
||||
{
|
||||
@ -4130,8 +4130,8 @@ void php_stripslashes_sse42(zend_string *str)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !ZEND_INTRIN_SSE4_2_NATIVE
|
||||
# if ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
#ifndef ZEND_INTRIN_SSE4_2_NATIVE
|
||||
# ifdef ZEND_INTRIN_SSE4_2_RESOLVER
|
||||
void php_stripslashes_default(zend_string *str) /* {{{ */
|
||||
# else
|
||||
PHPAPI void php_stripslashes(zend_string *str)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "zend_globals.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "php.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -333,7 +333,7 @@ enum {
|
||||
#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR
|
||||
#define STD_ARGS ctx, start, xp
|
||||
|
||||
#if SCANNER_DEBUG
|
||||
#ifdef SCANNER_DEBUG
|
||||
#define scdebug(x) printf x
|
||||
#else
|
||||
#define scdebug(x)
|
||||
|
Loading…
Reference in New Issue
Block a user