convert_scalar_to_number(pzv); \
}
-#if HAVE_SETLOCALE && defined(ZEND_WIN32) && !defined(ZTS) && defined(_MSC_VER)
+#if defined(ZEND_WIN32) && !defined(ZTS) && defined(_MSC_VER)
/* This performance improvement of tolower() on Windows gives 10-18% on bench.php */
#define ZEND_USE_TOLOWER_L 1
#endif
rand_r \
scandir \
setitimer \
-setlocale \
-localeconv \
setenv \
setpgid \
setsockopt \
#define php_pcre_mutex_unlock()
#endif
-#if HAVE_SETLOCALE
ZEND_TLS HashTable char_tables;
static void php_pcre_free_char_table(zval *data)
void *ptr = Z_PTR_P(data);
pefree(ptr, 1);
}/*}}}*/
-#endif
static void pcre_handle_exec_error(int pcre_code) /* {{{ */
{
#endif
php_pcre_init_pcre2(1);
-#if HAVE_SETLOCALE
zend_hash_init(&char_tables, 1, NULL, php_pcre_free_char_table, 1);
-#endif
}
/* }}} */
}
php_pcre_shutdown_pcre2();
-#if HAVE_SETLOCALE
zend_hash_destroy(&char_tables);
-#endif
-
php_pcre_mutex_free();
}
/* }}} */
char *pattern;
size_t pattern_len;
uint32_t poptions = 0;
-#if HAVE_SETLOCALE
const uint8_t *tables = NULL;
-#endif
zval *zv;
pcre_cache_entry new_entry;
int rc;
zend_string *key;
pcre_cache_entry *ret;
-#if HAVE_SETLOCALE
if (BG(locale_string) &&
(ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0);
memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1);
memcpy(ZSTR_VAL(key) + ZSTR_LEN(BG(locale_string)), ZSTR_VAL(regex), ZSTR_LEN(regex) + 1);
- } else
-#endif
- {
+ } else {
key = regex;
}
back the compiled pattern, otherwise go on and compile it. */
zv = zend_hash_find(&PCRE_G(pcre_cache), key);
if (zv) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
return (pcre_cache_entry*)Z_PTR_P(zv);
}
get to the end without encountering a delimiter. */
while (isspace((int)*(unsigned char *)p)) p++;
if (*p == 0) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
php_error_docref(NULL, E_WARNING,
p < ZSTR_VAL(regex) + ZSTR_LEN(regex) ? "Null byte in regex" : "Empty regular expression");
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
or a backslash. */
delimiter = *p++;
if (isalnum((int)*(unsigned char *)&delimiter) || delimiter == '\\') {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
php_error_docref(NULL,E_WARNING, "Delimiter must not be alphanumeric or backslash");
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
return NULL;
}
if (*pp == 0) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
if (pp < ZSTR_VAL(regex) + ZSTR_LEN(regex)) {
php_error_docref(NULL,E_WARNING, "Null byte in regex");
} else if (start_delimiter == end_delimiter) {
}
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
efree(pattern);
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
return NULL;
}
}
php_error_docref(NULL, E_WARNING, "The /e modifier is no longer supported, use preg_replace_callback instead");
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
efree(pattern);
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
return NULL;
}
-#if HAVE_SETLOCALE
if (key != regex) {
tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(locale_string));
if (!tables) {
}
pcre2_set_character_tables(cctx, tables);
}
-#endif
/* Set extra options for the compile context. */
if (PHP_PCRE_DEFAULT_EXTRA_COPTIONS != extra_coptions) {
}
if (re == NULL) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
pcre2_get_error_message(errnumber, error, sizeof(error));
php_error_docref(NULL,E_WARNING, "Compilation failed: %s at offset %zu", error, erroffset);
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
rc = pcre2_pattern_info(re, PCRE2_INFO_CAPTURECOUNT, &new_entry.capture_count);
if (rc < 0) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
php_error_docref(NULL, E_WARNING, "Internal pcre2_pattern_info() error %d", rc);
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
return NULL;
rc = pcre2_pattern_info(re, PCRE2_INFO_NAMECOUNT, &new_entry.name_count);
if (rc < 0) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
php_error_docref(NULL, E_WARNING, "Internal pcre_pattern_info() error %d", rc);
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
return NULL;
ret = zend_hash_add_new_mem(&PCRE_G(pcre_cache), key, &new_entry, sizeof(pcre_cache_entry));
}
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
return ret;
}
#include "pcre2.h"
#endif
-#if HAVE_LOCALE_H
#include <locale.h>
-#endif
PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count);
PHPAPI pcre2_code* pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count);
#include "zend_modules.h"
#include "SAPI.h"
-
-#if HAVE_SETLOCALE
#include <locale.h>
-#endif
#include "zend.h"
#include "zend_extensions.h"
#include "php_ini.h"
#endif
#include <string.h>
-
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
+#include <locale.h>
#if HAVE_SYS_MMAN_H
# include <sys/mman.h>
BASIC_MINIT_SUBMODULE(password)
BASIC_MINIT_SUBMODULE(mt_rand)
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
+#if defined(ZTS)
BASIC_MINIT_SUBMODULE(localeconv)
#endif
BASIC_MSHUTDOWN_SUBMODULE(url_scanner_ex)
BASIC_MSHUTDOWN_SUBMODULE(file)
BASIC_MSHUTDOWN_SUBMODULE(standard_filters)
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
+#if defined(ZTS)
BASIC_MSHUTDOWN_SUBMODULE(localeconv)
#endif
BASIC_MSHUTDOWN_SUBMODULE(crypt)
#include "zend_execute.h"
#include <stdio.h>
-#ifdef HAVE_LOCALE_H
#include <locale.h>
#ifdef ZTS
#include "ext/standard/php_string.h"
#else
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
#endif
-#else
-#define LCONV_DECIMAL_POINT '.'
-#endif
#define ALIGN_LEFT 0
#define ALIGN_RIGHT 1
char *s = NULL;
size_t s_len = 0;
int is_negative = 0;
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
struct lconv lconv;
#else
struct lconv *lconv;
-#endif
#endif
PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
case 'E':
case 'f':
case 'F':
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
lconv = localeconv();
-#endif
#endif
s = php_conv_fp((fmt == 'f')?'F':fmt, number, 0, precision,
(fmt == 'f')?LCONV_DECIMAL_POINT:'.',
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
lconv = localeconv();
-#endif
#endif
s = php_gcvt(number, precision, LCONV_DECIMAL_POINT, (fmt == 'G')?'E':'e', &num_buf[1]);
is_negative = 0;
#include "php_standard.h"
#include "php_string.h"
#include "SAPI.h"
-#if HAVE_LOCALE_H
#include <locale.h>
-#endif
#if HAVE_LANGINFO_H
#include <langinfo.h>
#endif
}
/* try to detect the charset for the locale */
-#if HAVE_NL_LANGINFO && HAVE_LOCALE_H && defined(CODESET)
+#if HAVE_NL_LANGINFO && defined(CODESET)
charset_hint = nl_langinfo(CODESET);
if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) {
goto det_charset;
}
#endif
-#if HAVE_LOCALE_H
/* try to figure out the charset from the locale */
{
char *localename;
len = strlen(charset_hint);
}
}
-#endif
det_charset:
PHP_FUNCTION(money_format);
#endif
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
+#if defined(ZTS)
PHP_MINIT_FUNCTION(localeconv);
PHP_MSHUTDOWN_FUNCTION(localeconv);
#endif
#define strnatcasecmp(a, b) \
strnatcmp_ex(a, strlen(a), b, strlen(b), 1)
PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case);
-
-#ifdef HAVE_LOCALECONV
PHPAPI struct lconv *localeconv_r(struct lconv *out);
-#endif
-
PHPAPI char *php_strtoupper(char *s, size_t len);
PHPAPI char *php_strtolower(char *s, size_t len);
PHPAPI zend_string *php_string_toupper(zend_string *s);
#include <ctype.h>
#include "php.h"
#include "php_variables.h"
-#ifdef HAVE_LOCALE_H
#include <locale.h>
-#endif
#include "zend_execute.h"
#include "zend_operators.h"
#include "zend_strtod.h"
#include "php_rand.h"
#include "php_string.h"
#include "php_variables.h"
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
+#include <locale.h>
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif
REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT);
-#ifdef HAVE_LOCALECONV
/* If last members of struct lconv equal CHAR_MAX, no grouping is done */
REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
-#endif
-
-#ifdef HAVE_LOCALE_H
REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT);
# ifdef LC_MESSAGES
REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT);
# endif
-#endif
}
/* }}} */
}
/* }}} */
-#ifdef HAVE_LOCALECONV
/* {{{ localeconv_r
* glibc's localeconv is not reentrant, so lets make it so ... sorta */
PHPAPI struct lconv *localeconv_r(struct lconv *out)
{
-# ifdef ZTS
+#ifdef ZTS
tsrm_mutex_lock( locale_mutex );
-# endif
+#endif
/* cur->locinfo is struct __crt_locale_info which implementation is
hidden in vc14. TODO revisit this and check if a workaround available
*out = *localeconv();
#endif
-# ifdef ZTS
+#ifdef ZTS
tsrm_mutex_unlock( locale_mutex );
-# endif
+#endif
return out;
}
/* }}} */
-# ifdef ZTS
+#ifdef ZTS
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(localeconv)
return SUCCESS;
}
/* }}} */
-# endif
#endif
/* {{{ proto string bin2hex(string data)
Z_PARAM_VARIADIC('+', args, num_args)
ZEND_PARSE_PARAMETERS_END();
-#ifdef HAVE_SETLOCALE
idx = 0;
while (1) {
if (Z_TYPE(args[0]) == IS_ARRAY) {
}
}
-#endif
RETURN_FALSE;
}
/* }}} */
array_init(&grouping);
array_init(&mon_grouping);
-#ifdef HAVE_LOCALECONV
{
struct lconv currlocdata;
add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn);
add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn);
}
-#else
- /* Ok, it doesn't look like we have locale info floating around, so I guess it
- wouldn't hurt to just go ahead and return the POSIX locale information? */
-
- add_index_long(&grouping, 0, -1);
- add_index_long(&mon_grouping, 0, -1);
-
- add_assoc_string(return_value, "decimal_point", "\x2E");
- add_assoc_string(return_value, "thousands_sep", "");
- add_assoc_string(return_value, "int_curr_symbol", "");
- add_assoc_string(return_value, "currency_symbol", "");
- add_assoc_string(return_value, "mon_decimal_point", "\x2E");
- add_assoc_string(return_value, "mon_thousands_sep", "");
- add_assoc_string(return_value, "positive_sign", "");
- add_assoc_string(return_value, "negative_sign", "");
- add_assoc_long( return_value, "int_frac_digits", CHAR_MAX);
- add_assoc_long( return_value, "frac_digits", CHAR_MAX);
- add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX);
- add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX);
- add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX);
- add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX);
- add_assoc_long( return_value, "p_sign_posn", CHAR_MAX);
- add_assoc_long( return_value, "n_sign_posn", CHAR_MAX);
-#endif
zend_hash_str_update(Z_ARRVAL_P(return_value), "grouping", sizeof("grouping")-1, &grouping);
zend_hash_str_update(Z_ARRVAL_P(return_value), "mon_grouping", sizeof("mon_grouping")-1, &mon_grouping);
#endif
#include <signal.h>
-
-#if HAVE_SETLOCALE
#include <locale.h>
-#endif
#include "zend.h"
#include "zend_types.h"
#include "zend_extensions.h"
zuf.getenv_function = sapi_getenv;
zuf.resolve_path_function = php_resolve_path_for_zend;
zend_startup(&zuf);
-
-#if HAVE_SETLOCALE
setlocale(LC_CTYPE, "");
zend_update_current_locale();
-#endif
#if HAVE_TZSET
tzset();
#include <inttypes.h>
#endif
-#ifdef HAVE_LOCALE_H
#include <locale.h>
#ifdef ZTS
#include "ext/standard/php_string.h"
#else
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
#endif
-#else
-#define LCONV_DECIMAL_POINT '.'
-#endif
/*
* Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
char num_buf[NUM_BUF_SIZE];
char char_buf[2]; /* for printing %% and %<unknown> */
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
struct lconv lconv;
#else
struct lconv *lconv = NULL;
-#endif
#endif
/*
s = "INF";
s_len = 3;
} else {
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
if (!lconv) {
lconv = localeconv();
}
-#endif
#endif
s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form,
(adjust_precision == NO) ? FLOAT_DIGITS : precision,
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
if (!lconv) {
lconv = localeconv();
}
-#endif
#endif
s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]);
if (*s == '-') {
#include <inttypes.h>
#endif
-#ifdef HAVE_LOCALE_H
#include <locale.h>
#ifdef ZTS
#include "ext/standard/php_string.h"
#else
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
#endif
-#else
-#define LCONV_DECIMAL_POINT '.'
-#endif
#include "snprintf.h"
char num_buf[NUM_BUF_SIZE];
char char_buf[2]; /* for printing %% and %<unknown> */
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
struct lconv lconv;
#else
struct lconv *lconv = NULL;
-#endif
#endif
/*
s = "inf";
s_len = 3;
} else {
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
if (!lconv) {
lconv = localeconv();
}
-#endif
#endif
s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form,
(adjust_precision == NO) ? FLOAT_DIGITS : precision,
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
if (!lconv) {
lconv = localeconv();
}
-#endif
#endif
s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]);
if (*s == '-')
#include <signal.h>
-#if HAVE_SETLOCALE
-# include <locale.h>
-#endif
+#include <locale.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <signal.h>
-
-#if HAVE_SETLOCALE
#include <locale.h>
-#endif
#include "zend.h"
#include "zend_extensions.h"
#include "php_ini.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
+
#include <signal.h>
-#if HAVE_SETLOCALE
#include <locale.h>
-#endif
+
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <signal.h>
-#if HAVE_SETLOCALE
-# include <locale.h>
-#endif
+#include <locale.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
*/
#define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES
-
-#ifdef HAVE_LOCALE_H
#include <locale.h>
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
-#else
-#define LCONV_DECIMAL_POINT '.'
-#endif
#define NUL '\0'
#define S_NULL "(null)"
#define S_NULL_LEN 6
char num_buf[NUM_BUF_SIZE];
char char_buf[2]; /* for printing %% and %<unknown> */
-#ifdef HAVE_LOCALE_H
struct lconv *lconv = NULL;
-#endif
/*
* Flag variables
s = "INF";
s_len = 3;
} else {
-#ifdef HAVE_LOCALE_H
if (!lconv) {
lconv = localeconv();
}
-#endif
+
s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form,
(adjust_precision == NO) ? FLOAT_DIGITS : precision,
(*fmt == 'f')?LCONV_DECIMAL_POINT:'.',
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
-#ifdef HAVE_LOCALE_H
if (!lconv) {
lconv = localeconv();
}
-#endif
+
s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]);
if (*s == '-') {
prefix_char = *s++;
#define HAVE_MEMMOVE 1
#define HAVE_PUTENV 1
#define HAVE_REGCOMP 1
-#define HAVE_SETLOCALE 1
-#define HAVE_LOCALECONV 1
#define HAVE_LOCALE_H 1
#ifndef HAVE_LIBBIND
# define HAVE_SETVBUF 1