On Tue, 8 Oct 2002, Moriyoshi Koizumi wrote:

> moriyoshi             Tue Oct  8 11:15:50 2002 EDT
> 
>   Modified files:              
>     /php4/ext/mbstring        mbregex.c 
>   Log:
>   Removed table generating code. The return values of isalnum() may vary by the 
>locale setting.

Please pay attention to CODING_STANDARDS nr 3...

        for (c = 0x80; c <= 0xff; c++) {

instead of:

        for (c=0x80; c<=0xff; c++) {


regards,
Derick


>    
>   
>   
> Index: php4/ext/mbstring/mbregex.c
> diff -u php4/ext/mbstring/mbregex.c:1.12 php4/ext/mbstring/mbregex.c:1.13
> --- php4/ext/mbstring/mbregex.c:1.12  Tue Oct  8 10:57:06 2002
> +++ php4/ext/mbstring/mbregex.c       Tue Oct  8 11:15:50 2002
> @@ -305,38 +305,26 @@
>  {
>       register int c;
>       static int done = 0;
> -     char *s = emalloc(10240), *sp;
> -     int ch;
> -     TSRMLS_FETCH();
>  
>       if (done) {
> -             efree(s);
>               return;
>       }
>  
> -   memset(re_syntax_table, 0, sizeof(re_syntax_table));
> +     memset(re_syntax_table, 0, sizeof(re_syntax_table));
>  
> -   for (c=0; c<=0x7f; c++)
> -     if (isalnum(c)) 
> -       re_syntax_table[c] = Sword;
> -   re_syntax_table['_'] = Sword;
> +     for (c=0; c<=0x7f; c++) {
> +             if (isalnum(c)) { 
> +                     re_syntax_table[c] = Sword;
> +             }
> +     }
> +     re_syntax_table['_'] = Sword;
>  
> -   for (c=0x80; c<=0xff; c++)
> -     if (isalnum(c)) 
> -       re_syntax_table[c] = Sword2;
> -   done = 1;
> -   
> -   
> -     sp = s;
> -     sprintf(sp, "static const char re_syntax_table[256] = {\n");
> -     for(ch =0; ch < 256;) {
> -             sp = s+strlen(s);
> -             sprintf(sp, "\t% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 2d,% 
>2d,% 2d,% 2d,% 2d,% 2d,% 2d,\n", rt[ch+0], rt[ch+1], rt[ch+2], rt[ch+3], rt[ch+4], 
>rt[ch+5], rt[ch+6], rt[ch+7], rt[ch+8], rt[ch+9], rt[ch+10], rt[ch+11], rt[ch+12], 
>rt[ch+13], rt[ch+14], rt[ch+15]);
> -             ch += 16;
> +     for (c=0x80; c<=0xff; c++) {
> +             if (isalnum(c)) { 
> +                     re_syntax_table[c] = Sword2;
> +             }
>       }
> -     sprintf(sp, "};");
> -/*   php_error_docref(NULL TSRMLS_CC, E_NOTICE, "reverse_table:\n%s", s); */
> -     efree(s);
> +     done = 1;
>  }
>  
>  void
> 
> 
> 
> -- 
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--

---------------------------------------------------------------------------
 Derick Rethans                                   http://derickrethans.nl/ 
 JDI Media Solutions
--------------[ if you hold a unix shell to your ear, do you hear the c? ]-


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to