From 22fb73c71e121336767985f35ab8cc5b0d065516 Mon Sep 17 00:00:00 2001 From: Steph Fox Date: Sat, 21 Jun 2008 19:40:41 +0000 Subject: [PATCH] - Fix macro definition syntax - Remove pre-existing workaround --- ext/phar/phar_internal.h | 3 ++- ext/phar/zip.c | 12 ++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index e41101ab3d..e8873dec5c 100755 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -80,7 +80,8 @@ #endif #ifndef ALLOC_PERMANENT_ZVAL -# define ALLOC_PERMANENT_ZVAL (z) = (zval*)malloc(sizeof(zval)); +# define ALLOC_PERMANENT_ZVAL(z) \ + (z) = (zval*)malloc(sizeof(zval)) #endif /* PHP_ because this is public information via MINFO */ diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 636360b90f..54a6c75583 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -213,15 +213,13 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, if (phar_parse_metadata(&metadata, &mydata->metadata, PHAR_GET_16(locator.comment_len) TSRMLS_CC) == FAILURE) { mydata->metadata_len = 0; /* if not valid serialized data, it is a regular string */ -#if PHP_VERSION_ID >= 50300 + if (entry.is_persistent) { ALLOC_PERMANENT_ZVAL(mydata->metadata); } else { ALLOC_ZVAL(mydata->metadata); } -#else - ALLOC_ZVAL(mydata->metadata); -#endif + INIT_ZVAL(*mydata->metadata); metadata = pestrndup(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent); ZVAL_STRINGL(mydata->metadata, metadata, PHAR_GET_16(locator.comment_len), 0); @@ -409,15 +407,13 @@ foundit: if (phar_parse_metadata(&p, &(entry.metadata), PHAR_GET_16(zipentry.comment_len) TSRMLS_CC) == FAILURE) { entry.metadata_len = 0; /* if not valid serialized data, it is a regular string */ -#if PHP_VERSION_ID >= 50300 + if (entry.is_persistent) { ALLOC_PERMANENT_ZVAL(entry.metadata); } else { ALLOC_ZVAL(entry.metadata); } -#else - ALLOC_ZVAL(entry.metadata); -#endif + INIT_ZVAL(*entry.metadata); ZVAL_STRINGL(entry.metadata, pestrndup(buf, PHAR_GET_16(zipentry.comment_len), entry.is_persistent), PHAR_GET_16(zipentry.comment_len), 0); } -- 2.40.0