At 6:29 PM +0100 9/1/02, James Cox wrote:
>Where is your patch?

The patch basically renames php_treat_data to php_treat_data_default,
creates a function pointer called php_treat_data that is defaulted to
php_treat_data_default, removes all mbstrings references in php_main.h
and makes mbstring.c change the php_treat_data to mbstr_treat_data in
the INIT function and restores its value in SHUTDOWN.

This allows us to only load the mbstrings extension on the machines 
that need it, which is a very small percentage of our over all server 
count.

This patch is based off of the 4.2.2 release and there have been 
changes in CVS to the exif extension that may need mbstring to be 
static because it is expecting mbstr_treat_data to be handling the 
php_treat_data stuff.

There was also talk about moving the changing mbstr_treat_data to be 
the default handler since there was so much duplicate code in 
mbstring.

Thanks,

Brian

------

diff -rc php-4.2.2/ext/mbstring/mbstring.c php-4.2.2/ext/mbstring/mbstring.c
*** php-4.2.2/ext/mbstring/mbstring.c   Wed Apr 24 02:46:23 2002
--- php-4.2.2/ext/mbstring/mbstring.c   Mon Jun 10 14:10:58 2002
***************
*** 93,98 ****
--- 93,100 ----
        { MULTIPART_CONTENT_TYPE, 
        sizeof(MULTIPART_CONTENT_TYPE)-1,       NULL, 
        rfc1867_post_handler },
        { NULL, 0, NULL, NULL }
   };
+
+ void mbstr_treat_data(int arg, char *str, zval* destArray TSRMLS_DC);
   #endif

   static struct mb_overload_def mb_ovld[] = {
***************
*** 529,534 ****
--- 531,538 ----
   #if defined(MBSTR_ENC_TRANS)
        sapi_unregister_post_entry(mbstr_post_entries);
        sapi_register_post_entries(mbstr_post_entries);
+
+     php_treat_data = mbstr_treat_data;
   #endif

        REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, 
CONST_CS | CONST_PERSISTENT);
***************
*** 552,557 ****
--- 556,565 ----

   #if HAVE_MBREGEX
        zend_hash_destroy(&MBSTRG(ht_rc));
+ #endif
+
+ #if defined(MBSTR_ENC_TRANS)
+     php_treat_data = php_treat_data_default;
   #endif

        return SUCCESS;
diff -rc php-4.2.2/main/php_main.h php-4.2.2/main/php_main.h
*** php-4.2.2/main/php_main.h   Mon Mar  4 10:46:55 2002
--- php-4.2.2/main/php_main.h   Mon Jun 10 14:09:59 2002
***************
*** 53,60 ****
   extern int php_init_environ(void);
   extern int php_shutdown_environ(void);

- #if defined(MBSTR_ENC_TRANS)
- #define php_treat_data mbstr_treat_data
- #endif
-
   #endif
--- 53,56 ----
diff -rc php-4.2.2/main/php_variables.c php-4.2.2/main/php_variables.c
*** php-4.2.2/main/php_variables.c      Tue Dec 11 07:31:05 2001
--- php-4.2.2/main/php_variables.c      Mon Jun 10 14:09:59 2002
***************
*** 28,33 ****
--- 28,34 ----

   #include "zend_globals.h"

+ void *(*php_treat_data)(int arg, char *str, zval* destArray 
TSRMLS_DC) = php_treat_data_default;

   PHPAPI void php_register_variable(char *var, char *strval, zval 
*track_vars_array TSRMLS_DC)
   {
***************
*** 215,221 ****
   }


! void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
   {
        char *res = NULL, *var, *val, *separator=NULL;
        const char *c_var;
--- 216,222 ----
   }


! void php_treat_data_default(int arg, char *str, zval* destArray TSRMLS_DC)
   {
        char *res = NULL, *var, *val, *separator=NULL;
        const char *c_var;
diff -rc php-4.2.2/main/php_variables.h php-4.2.2/main/php_variables.h
*** php-4.2.2/main/php_variables.h      Tue Dec 11 07:31:05 2001
--- php-4.2.2/main/php_variables.h      Mon Jun 10 14:09:59 2002
***************
*** 30,36 ****
   #define PARSE_COOKIE 2
   #define PARSE_STRING 3

! void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC);
   PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC);
   PHPAPI void php_register_variable(char *var, char *val, pval 
*track_vars_array TSRMLS_DC);
   /* binary-safe version */
--- 30,39 ----
   #define PARSE_COOKIE 2
   #define PARSE_STRING 3

! extern void *(*php_treat_data)(int arg, char *str, zval* destArray 
TSRMLS_DC);
!
! void php_treat_data_default(int arg, char *str, zval* destArray TSRMLS_DC);
!
   PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC);
   PHPAPI void php_register_variable(char *var, char *val, pval 
*track_vars_array TSRMLS_DC);
   /* binary-safe version */

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to