From 84a00407857506ab8cfb9335cbe5f495a68e0880 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Sun, 11 Jun 2006 16:40:41 +0000 Subject: [PATCH] - attempt to fix gcc-2.95 build by using less HTTP_HAVE_$EXT magic --- http.c | 8 ++++---- http_functions.c | 4 ++-- http_message_object.c | 4 ++-- http_querystring_api.c | 4 ++-- http_querystring_object.c | 6 +++--- package2.xml | 9 ++------- php_http.h | 18 ++++++++++++++++-- php_http_cache_api.h | 11 ++++------- php_http_querystring_api.h | 2 +- php_http_querystring_object.h | 2 +- 10 files changed, 37 insertions(+), 31 deletions(-) diff --git a/http.c b/http.c index 1dba9c6..348940b 100644 --- a/http.c +++ b/http.c @@ -137,16 +137,16 @@ PHP_MINFO_FUNCTION(http); /* {{{ http_module_dep */ #if ZEND_EXTENSION_API_NO >= 220050617 static zend_module_dep http_module_deps[] = { -# if HTTP_HAVE_EXT(SPL) +# ifdef HTTP_HAVE_SPL ZEND_MOD_REQUIRED("spl") # endif -# if HTTP_HAVE_EXT_HASH +# ifdef HTTP_HAVE_HASH ZEND_MOD_REQUIRED("hash") # endif -# if HTTP_HAVE_EXT(SESSION) +# ifdef HTTP_HAVE_SESSION ZEND_MOD_REQUIRED("session") # endif -# if HTTP_HAVE_EXT(ICONV) +# ifdef HTTP_HAVE_ICONV ZEND_MOD_REQUIRED("iconv") # endif {NULL, NULL, NULL, 0} diff --git a/http_functions.c b/http_functions.c index 930908d..bf1e193 100644 --- a/http_functions.c +++ b/http_functions.c @@ -21,7 +21,7 @@ #include "ext/standard/php_string.h" #include "zend_operators.h" -#if HTTP_HAVE_EXT(SESSION) +#ifdef HTTP_HAVE_SESSION # include "ext/session/php_session.h" #endif @@ -728,7 +728,7 @@ PHP_FUNCTION(http_redirect) RETURN_FALSE; } -#if HTTP_HAVE_EXT(SESSION) +#ifdef HTTP_HAVE_SESSION /* append session info */ if (session) { if (!params) { diff --git a/http_message_object.c b/http_message_object.c index 56b1a1e..a1b3141 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -33,7 +33,7 @@ #include "php_http_request_api.h" #include "php_http_request_object.h" -#if HTTP_HAVE_EXT(SPL) && !defined(WONKY) +#if defined(HTTP_HAVE_SPL) && !defined(WONKY) /* SPL doesn't install its headers */ extern PHPAPI zend_class_entry *spl_ce_Countable; #endif @@ -192,7 +192,7 @@ PHP_MINIT_FUNCTION(http_message_object) HTTP_REGISTER_CLASS_EX(HttpMessage, http_message_object, NULL, 0); #ifndef WONKY -# if HTTP_HAVE_EXT(SPL) +# ifdef HTTP_HAVE_SPL zend_class_implements(http_message_object_ce TSRMLS_CC, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator); # else zend_class_implements(http_message_object_ce TSRMLS_CC, 2, zend_ce_serializable, zend_ce_iterator); diff --git a/http_querystring_api.c b/http_querystring_api.c index 03fe726..76af348 100644 --- a/http_querystring_api.c +++ b/http_querystring_api.c @@ -16,7 +16,7 @@ #include "php_http.h" #include "php_variables.h" -#if HTTP_HAVE_EXT(ICONV) +#ifdef HTTP_HAVE_ICONV # undef PHP_ATOM_INC # include "ext/iconv/php_iconv.h" # include "ext/standard/url.h" @@ -38,7 +38,7 @@ static inline int _http_querystring_modify_array_ex(zval *qarray, int key_type, static inline int _http_querystring_modify_array(zval *qarray, zval *params TSRMLS_DC); -#if HTTP_HAVE_EXT(ICONV) +#ifdef HTTP_HAVE_ICONV PHP_HTTP_API int _http_querystring_xlate(zval *array, zval *param, const char *ie, const char *oe TSRMLS_DC) { HashPosition pos; diff --git a/http_querystring_object.c b/http_querystring_object.c index 580ae6b..cdbabbb 100644 --- a/http_querystring_object.c +++ b/http_querystring_object.c @@ -61,7 +61,7 @@ HTTP_BEGIN_ARGS(__getter, 1) HTTP_ARG_VAL(delete, 0) HTTP_END_ARGS; -#if HTTP_HAVE_EXT(ICONV) +#ifdef HTTP_HAVE_ICONV HTTP_BEGIN_ARGS(xlate, 2) HTTP_ARG_VAL(from_encoding, 0) HTTP_ARG_VAL(to_encoding, 0) @@ -95,7 +95,7 @@ zend_function_entry http_querystring_object_fe[] = { #ifndef WONKY HTTP_QUERYSTRING_ME(singleton, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) #endif -#if HTTP_HAVE_EXT(ICONV) +#ifdef HTTP_HAVE_ICONV HTTP_QUERYSTRING_ME(xlate, ZEND_ACC_PUBLIC) #endif @@ -431,7 +431,7 @@ HTTP_QUERYSTRING_GETTER(getArray, IS_ARRAY); HTTP_QUERYSTRING_GETTER(getObject, IS_OBJECT); /* }}} */ -#if HTTP_HAVE_EXT(ICONV) +#ifdef HTTP_HAVE_ICONV /* {{{ proto bool HttpQueryString::xlate(string ie, string oe) * * Converts the query string from the source encoding ie to the target encoding oe. diff --git a/package2.xml b/package2.xml index be45841..1309fdd 100644 --- a/package2.xml +++ b/package2.xml @@ -30,7 +30,7 @@ support. Parallel requests are available for PHP 5 and greater. 2006-00-00 - 1.0.0 + 1.0.1 1.0.0 @@ -39,12 +39,7 @@ support. Parallel requests are available for PHP 5 and greater. BSD, revised diff --git a/php_http.h b/php_http.h index c3ef9f8..431e7fb 100644 --- a/php_http.h +++ b/php_http.h @@ -15,7 +15,7 @@ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H -#define PHP_EXT_HTTP_VERSION "1.0.0" +#define PHP_EXT_HTTP_VERSION "1.0.1dev" #ifdef HAVE_CONFIG_H # include "config.h" @@ -144,7 +144,21 @@ ZEND_EXTERN_MODULE_GLOBALS(http); # define HTTP_G (&http_globals) #endif -#define HTTP_HAVE_EXT(EXT) ((defined(HAVE_##EXT) || defined(HAVE_PHP_##EXT) || defined(HAVE_##EXT##_EXT)) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_##EXT))) +#if defined(HAVE_ICONV) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV)) +# define HTTP_HAVE_ICONV +#endif + +#if defined(HAVE_PHP_SESSION) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_SESSION)) +# define HTTP_HAVE_SESSION +#endif + +#if defined(HAVE_HASH_EXT) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_HASH) && defined(HTTP_HAVE_PHP_HASH_H)) +# define HTTP_HAVE_HASH +#endif + +#if defined(HAVE_SPL) +# define HTTP_HAVE_SPL +#endif PHP_FUNCTION(http_test); PHP_FUNCTION(http_date); diff --git a/php_http_cache_api.h b/php_http_cache_api.h index 3c2e783..dc9b515 100644 --- a/php_http_cache_api.h +++ b/php_http_cache_api.h @@ -21,11 +21,8 @@ #include "ext/standard/sha1.h" #include "ext/standard/md5.h" -#if defined(HTTP_HAVE_PHP_HASH_H) && HTTP_HAVE_EXT(HASH) -# define HTTP_HAVE_EXT_HASH 1 +#ifdef HTTP_HAVE_HASH # include "php_hash.h" -#else -# define HTTP_HAVE_EXT_HASH 0 #endif #define http_etag_digest(d, l) _http_etag_digest((d), (l)) @@ -51,7 +48,7 @@ static inline void *_http_etag_init(TSRMLS_D) void *ctx = NULL; char *mode = HTTP_G->etag.mode; -#if HTTP_HAVE_EXT_HASH +#ifdef HTTP_HAVE_HASH php_hash_ops *eho = NULL; if (mode && (eho = php_hash_fetch_ops(mode, strlen(mode)))) { @@ -77,7 +74,7 @@ static inline char *_http_etag_finish(void *ctx TSRMLS_DC) unsigned char digest[128] = {0}; char *etag = NULL, *mode = HTTP_G->etag.mode; -#if HTTP_HAVE_EXT_HASH +#ifdef HTTP_HAVE_HASH php_hash_ops *eho = NULL; if (mode && (eho = php_hash_fetch_ops(mode, strlen(mode)))) { @@ -104,7 +101,7 @@ static inline char *_http_etag_finish(void *ctx TSRMLS_DC) static inline void _http_etag_update(void *ctx, const char *data_ptr, size_t data_len TSRMLS_DC) { char *mode = HTTP_G->etag.mode; -#if HTTP_HAVE_EXT_HASH +#ifdef HTTP_HAVE_HASH php_hash_ops *eho = NULL; if (mode && (eho = php_hash_fetch_ops(mode, strlen(mode)))) { diff --git a/php_http_querystring_api.h b/php_http_querystring_api.h index 60b63bc..2960b1d 100644 --- a/php_http_querystring_api.h +++ b/php_http_querystring_api.h @@ -15,7 +15,7 @@ #ifndef PHP_HTTP_QUERYSTRING_API_H #define PHP_HTTP_QUERYSTRING_API_H -#if HTTP_HAVE_EXT(ICONV) +#ifdef HTTP_HAVE_ICONV #define http_querystring_xlate(a, p, ie, oe) _http_querystring_xlate((a), (p), (ie), (oe) TSRMLS_CC) PHP_HTTP_API int _http_querystring_xlate(zval *array, zval *param, const char *ie, const char *oe TSRMLS_DC); #endif diff --git a/php_http_querystring_object.h b/php_http_querystring_object.h index 76f2513..63a47d8 100644 --- a/php_http_querystring_object.h +++ b/php_http_querystring_object.h @@ -50,7 +50,7 @@ PHP_METHOD(HttpQueryString, getFloat); PHP_METHOD(HttpQueryString, getString); PHP_METHOD(HttpQueryString, getArray); PHP_METHOD(HttpQueryString, getObject); -#if HTTP_HAVE_EXT(ICONV) +#ifdef HTTP_HAVE_ICONV PHP_METHOD(HttpQueryString, xlate); #endif #ifndef WONKY -- 2.30.2