]> granicus.if.org Git - php/commitdiff
Don't guard mbstring code with #ifdef HAVE_MBSTRING
authorAlex Dowad <alexinbeijing@gmail.com>
Sun, 5 Jul 2020 18:05:29 +0000 (20:05 +0200)
committerAlex Dowad <alexinbeijing@gmail.com>
Mon, 31 Aug 2020 21:18:13 +0000 (23:18 +0200)
This is just a very silly feature of mbstring -- you can compile the source files with
HAVE_MBSTRING undefined, and it will all just compile to (almost) nothing. What is the
use of this? Why compile the source files and link against them if you don't want the
mbstring extension? It doesn't make any kind of sense.

ext/mbstring/mb_gpc.c
ext/mbstring/mb_gpc.h
ext/mbstring/mbstring.c
ext/mbstring/mbstring.h
ext/mbstring/php_unicode.c
ext/mbstring/php_unicode.h

index 951b59fb9cb3c6e50842d389c41c20b47a3ce5f7..4cc81bc97705972520f34a960eca3f369539a8de 100644 (file)
@@ -37,8 +37,6 @@
 #include "mb_gpc.h"
 /* }}} */
 
-#ifdef HAVE_MBSTRING
-
 ZEND_EXTERN_MODULE_GLOBALS(mbstring)
 
 /* {{{ MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
@@ -373,5 +371,3 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
        }
 }
 /* }}} */
-
-#endif /* HAVE_MBSTRING */
index 9ee258e9413242f3d67a4341f497892e2012d5e7..397f70fd05c633eef9b100651dba0940d8fc8a69 100644 (file)
@@ -19,7 +19,6 @@
 #include "php.h"
 /* }}} */
 
-#ifdef HAVE_MBSTRING
 /* {{{ typedefs */
 typedef struct _php_mb_encoding_handler_info_t {
        const char *separator;
@@ -41,4 +40,3 @@ MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data);
 int _php_mb_enable_encoding_translation(int flag);
 const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_info_t *info, zval *arg, char *res);
 /* }}} */
-#endif /* HAVE_MBSTRING */
index 6d19d25156e5c9af904673472d048d458f394419..c400a2f5ee45276e7d81ecc2314facf91303521e 100644 (file)
@@ -74,8 +74,6 @@ onig_match(re, str, end, at, region, option)
 #include "mbstring_arginfo.h"
 /* }}} */
 
-#ifdef HAVE_MBSTRING
-
 /* {{{ prototypes */
 ZEND_DECLARE_MODULE_GLOBALS(mbstring)
 
@@ -4532,5 +4530,3 @@ static void php_mb_gpc_set_input_encoding(const zend_encoding *encoding) /* {{{
        MBSTRG(http_input_identify) = (const mbfl_encoding*)encoding;
 }
 /* }}} */
-
-#endif /* HAVE_MBSTRING */
index af15a30f753e352f4d0e157ae04e389d21c9eed8..561efeb422ba6378d97273b03d7f242717bc758e 100644 (file)
 #      define MBSTRING_API /* nothing special */
 #endif
 
-#ifdef HAVE_MBSTRING
-
 #include "libmbfl/mbfl/mbfilter.h"
 #include "SAPI.h"
 
 #define PHP_MBSTRING_API 20021024
 
 extern zend_module_entry mbstring_module_entry;
-#define mbstring_module_ptr &mbstring_module_entry
+#define phpext_mbstring_ptr &mbstring_module_entry
 
 PHP_MINIT_FUNCTION(mbstring);
 PHP_MSHUTDOWN_FUNCTION(mbstring);
@@ -123,12 +121,4 @@ ZEND_END_MODULE_GLOBALS(mbstring)
 ZEND_TSRMLS_CACHE_EXTERN()
 #endif
 
-#else  /* HAVE_MBSTRING */
-
-#define mbstring_module_ptr NULL
-
-#endif /* HAVE_MBSTRING */
-
-#define phpext_mbstring_ptr mbstring_module_ptr
-
-#endif         /* _MBSTRING_H */
+#endif /* _MBSTRING_H */
index c96d9b7180f3982cc63a779d7ae12b754d412666..d0cf9f55e538f23cdba243757d87841d3186d8d5 100644 (file)
@@ -30,8 +30,6 @@
 
 #include "php.h"
 
-#ifdef HAVE_MBSTRING
-
 /* include case folding data generated from the official UnicodeData.txt file */
 #include "mbstring.h"
 #include "php_unicode.h"
@@ -440,6 +438,3 @@ MBSTRING_API char *php_unicode_convert_case(
        *ret_len = result.len;
        return (char *) result.val;
 }
-
-
-#endif /* HAVE_MBSTRING */
index 26d0979ca45f15f8f7d5dae5fe23a9a80da59b14..445f6f3a8d3b732bf1fd207a204241439e2f0630 100644 (file)
@@ -31,8 +31,6 @@
 #ifndef PHP_UNICODE_H
 #define PHP_UNICODE_H
 
-#ifdef HAVE_MBSTRING
-
 #define UC_MN  0 /* Mark, Non-Spacing          */
 #define UC_MC  1 /* Mark, Spacing Combining    */
 #define UC_ME  2 /* Mark, Enclosing            */
@@ -190,8 +188,4 @@ static inline int php_unicode_is_upper(unsigned long code) {
 #define php_unicode_is_cased(cc) php_unicode_is_prop1(cc, UC_CASED)
 #define php_unicode_is_case_ignorable(cc) php_unicode_is_prop1(cc, UC_CASE_IGNORABLE)
 
-
-#endif
-
-
 #endif /* PHP_UNICODE_H */