Skip to content

Commit 7eddcab

Browse files
committed
Don't guard mbstring code with #ifdef HAVE_MBSTRING
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.
1 parent 62317d5 commit 7eddcab

File tree

6 files changed

+2
-33
lines changed

6 files changed

+2
-33
lines changed

ext/mbstring/mb_gpc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
#include "mb_gpc.h"
3838
/* }}} */
3939

40-
#ifdef HAVE_MBSTRING
41-
4240
ZEND_EXTERN_MODULE_GLOBALS(mbstring)
4341

4442
/* {{{ MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
@@ -373,5 +371,3 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
373371
}
374372
}
375373
/* }}} */
376-
377-
#endif /* HAVE_MBSTRING */

ext/mbstring/mb_gpc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "php.h"
2020
/* }}} */
2121

22-
#ifdef HAVE_MBSTRING
2322
/* {{{ typedefs */
2423
typedef struct _php_mb_encoding_handler_info_t {
2524
const char *separator;
@@ -41,4 +40,3 @@ MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data);
4140
int _php_mb_enable_encoding_translation(int flag);
4241
const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_info_t *info, zval *arg, char *res);
4342
/* }}} */
44-
#endif /* HAVE_MBSTRING */

ext/mbstring/mbstring.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ onig_match(re, str, end, at, region, option)
7474
#include "mbstring_arginfo.h"
7575
/* }}} */
7676

77-
#ifdef HAVE_MBSTRING
78-
7977
/* {{{ prototypes */
8078
ZEND_DECLARE_MODULE_GLOBALS(mbstring)
8179

@@ -4532,5 +4530,3 @@ static void php_mb_gpc_set_input_encoding(const zend_encoding *encoding) /* {{{
45324530
MBSTRG(http_input_identify) = (const mbfl_encoding*)encoding;
45334531
}
45344532
/* }}} */
4535-
4536-
#endif /* HAVE_MBSTRING */

ext/mbstring/mbstring.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@
3939
# define MBSTRING_API /* nothing special */
4040
#endif
4141

42-
#ifdef HAVE_MBSTRING
43-
4442
#include "libmbfl/mbfl/mbfilter.h"
4543
#include "SAPI.h"
4644

4745
#define PHP_MBSTRING_API 20021024
4846

4947
extern zend_module_entry mbstring_module_entry;
50-
#define mbstring_module_ptr &mbstring_module_entry
48+
#define phpext_mbstring_ptr &mbstring_module_entry
5149

5250
PHP_MINIT_FUNCTION(mbstring);
5351
PHP_MSHUTDOWN_FUNCTION(mbstring);
@@ -123,12 +121,4 @@ ZEND_END_MODULE_GLOBALS(mbstring)
123121
ZEND_TSRMLS_CACHE_EXTERN()
124122
#endif
125123

126-
#else /* HAVE_MBSTRING */
127-
128-
#define mbstring_module_ptr NULL
129-
130-
#endif /* HAVE_MBSTRING */
131-
132-
#define phpext_mbstring_ptr mbstring_module_ptr
133-
134-
#endif /* _MBSTRING_H */
124+
#endif /* _MBSTRING_H */

ext/mbstring/php_unicode.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
#include "php.h"
3232

33-
#ifdef HAVE_MBSTRING
34-
3533
/* include case folding data generated from the official UnicodeData.txt file */
3634
#include "mbstring.h"
3735
#include "php_unicode.h"
@@ -440,6 +438,3 @@ MBSTRING_API char *php_unicode_convert_case(
440438
*ret_len = result.len;
441439
return (char *) result.val;
442440
}
443-
444-
445-
#endif /* HAVE_MBSTRING */

ext/mbstring/php_unicode.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
#ifndef PHP_UNICODE_H
3232
#define PHP_UNICODE_H
3333

34-
#ifdef HAVE_MBSTRING
35-
3634
#define UC_MN 0 /* Mark, Non-Spacing */
3735
#define UC_MC 1 /* Mark, Spacing Combining */
3836
#define UC_ME 2 /* Mark, Enclosing */
@@ -190,8 +188,4 @@ static inline int php_unicode_is_upper(unsigned long code) {
190188
#define php_unicode_is_cased(cc) php_unicode_is_prop1(cc, UC_CASED)
191189
#define php_unicode_is_case_ignorable(cc) php_unicode_is_prop1(cc, UC_CASE_IGNORABLE)
192190

193-
194-
#endif
195-
196-
197191
#endif /* PHP_UNICODE_H */

0 commit comments

Comments
 (0)