Fine with the concept.

    If you move the additional check (newlen <
    SMART_STR_START_SIZE) and preallocation into the if (!(d)->c)
    branch, the changes won't affect the common code path.

> @@ -47,7 +51,11 @@
>       if (!(d)->c) (d)->len = (d)->a = 0;                                            
>                  \
>       newlen = (d)->len + (n);                                                       
>                          \
>       if (newlen >= (d)->a) {                                                        
>                          \
> +             if((d)->a == 0 && newlen < SMART_STR_START_SIZE) {                     
>  \
> +                     (d)->a = SMART_STR_START_SIZE;                                 
>                  \
> +             } else {                                                               
>                                          \
>               (d)->a = newlen + SMART_STR_PREALLOC;                                  
>          \
> +             }                                                                      
>                                                  \
>               (d)->c = SMART_STR_REALLOC((d)->c, (d)->a + 1, (what));         \
>       }                                                                              
>                                                  \
>  } while (0)

    - Sascha

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

Reply via email to