sas Sun Mar 16 18:03:46 2003 EDT Modified files: (Branch: PHP_4) /php4/ext/standard php_smart_str.h Log: Preserve explicit casting semantics from functions, so that you can also pass void pointers to the macros. Index: php4/ext/standard/php_smart_str.h diff -u php4/ext/standard/php_smart_str.h:1.22.4.1.2.1 php4/ext/standard/php_smart_str.h:1.22.4.1.2.2 --- php4/ext/standard/php_smart_str.h:1.22.4.1.2.1 Sat Mar 8 09:37:25 2003 +++ php4/ext/standard/php_smart_str.h Sun Mar 16 18:03:46 2003 @@ -76,19 +76,21 @@ } while (0) #define smart_str_free_ex(s, what) do { \ - if ((s)->c) { \ - pefree((s)->c, what); \ - (s)->c = NULL; \ + smart_str *__s = (smart_str *) (s); \ + if (__s->c) { \ + pefree(__s->c, what); \ + __s->c = NULL; \ } \ - (s)->a = (s)->len = 0; \ + __s->a = __s->len = 0; \ } while (0) #define smart_str_appendl_ex(dest, src, nlen, what) do { \ register size_t __nl; \ + smart_str *__dest = (smart_str *) (dest); \ \ - smart_str_alloc4((dest), (nlen), (what), __nl); \ - memcpy((dest)->c + (dest)->len, (src), (nlen)); \ - (dest)->len = __nl; \ + smart_str_alloc4(__dest, (nlen), (what), __nl); \ + memcpy(__dest->c + __dest->len, (src), (nlen)); \ + __dest->len = __nl; \ } while (0) /* input: buf points to the END of the buffer */ @@ -152,7 +154,8 @@ smart_str_append_generic_ex((dest), (num), (type), off_t, _long) #define smart_str_append_ex(dest, src, what) \ - smart_str_appendl_ex((dest), (src)->c, (src)->len, (what)); + smart_str_appendl_ex((dest), ((smart_str *)(src))->c, \ + ((smart_str *)(src))->len, (what)); #define smart_str_setl(dest, src, nlen) do { \
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php