1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00

Clean up STR_CAT macro (it is still ugly)

This commit is contained in:
Sascha Schumann
2000-09-27 15:24:09 +00:00
parent 1cc3e6b5e6
commit 5bf4e7857d

View File

@@ -169,14 +169,9 @@ typedef struct {
#define STR_CAT(P,S,I) {\
pval *__p = (P);\
size_t __l = (I);\
ulong __i = Z_STRLEN_P(__p);\
Z_STRLEN_P(__p) += __l;\
if (Z_STRVAL_P(__p)) {\
Z_STRVAL_P(__p) = (char *)erealloc(Z_STRVAL_P(__p), Z_STRLEN_P(__p) + 1);\
} else {\
Z_STRVAL_P(__p) = emalloc(Z_STRLEN_P(__p) + 1);\
*Z_STRVAL_P(__p) = 0;\
}\
ulong __i = Z_STRLEN_P(__p);\
Z_STRLEN_P(__p) += __l;\
Z_STRVAL_P(__p) = (char *)erealloc(Z_STRVAL_P(__p), Z_STRLEN_P(__p) + 1);\
memcpy(Z_STRVAL_P(__p) + __i, (S), __l); \
Z_STRVAL_P(__p)[Z_STRLEN_P(__p)] = '\0'; \
}