X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_cache_api.h;h=d7e53b77b41bc5c073ae52e6ef3c66a750919387;hp=3e882c9e2fd57b6a688ce9554b72d6e79dc93f49;hb=ff17beb99d61462cf1791eecdb3f68dbd2aea5e5;hpb=1e4135540cb45994d2fc3ef3ede3bc168a7d839c diff --git a/php_http_cache_api.h b/php_http_cache_api.h index 3e882c9..d7e53b7 100644 --- a/php_http_cache_api.h +++ b/php_http_cache_api.h @@ -28,19 +28,21 @@ #include "php_http_api.h" #include "php_http_send_api.h" -#ifdef HAVE_LIBMHASH +#ifdef HTTP_HAVE_MHASH # include #endif ZEND_EXTERN_MODULE_GLOBALS(http); +#define http_cache_global_init() _http_cache_global_init(INIT_FUNC_ARGS_PASSTHRU) +extern STATUS _http_cache_global_init(INIT_FUNC_ARGS); + typedef enum { HTTP_ETAG_MD5 = -2, HTTP_ETAG_SHA1 = -1, - HTTP_ETAG_MHASH = 0, } http_etag_mode; -#ifdef HAVE_LIBMHASH +#ifdef HTTP_HAVE_MHASH static void *http_etag_alloc_mhash_digest(size_t size) { return emalloc(size); @@ -78,13 +80,13 @@ static inline void *_http_etag_init(TSRMLS_D) break; case HTTP_ETAG_MD5: -#ifndef HAVE_LIBMHASH +#ifndef HTTP_HAVE_MHASH default: #endif PHP_MD5Init(ctx = emalloc(sizeof(PHP_MD5_CTX))); break; -#ifdef HAVE_LIBMHASH +#ifdef HTTP_HAVE_MHASH default: if ((mode < 0) || ((ulong)mode > mhash_count()) || (!(ctx = mhash_init(mode)))) { http_error_ex(HE_ERROR, HTTP_E_RUNTIME, "Invalid ETag mode: %ld", mode); @@ -112,7 +114,7 @@ static inline char *_http_etag_finish(void *ctx TSRMLS_DC) break; case HTTP_ETAG_MD5: -#ifndef HAVE_LIBMHASH +#ifndef HTTP_HAVE_MHASH default: #endif PHP_MD5Final(digest, ctx); @@ -120,7 +122,7 @@ static inline char *_http_etag_finish(void *ctx TSRMLS_DC) efree(ctx); break; -#ifdef HAVE_LIBMHASH +#ifdef HTTP_HAVE_MHASH default: { unsigned char *mhash_digest = mhash_end_m(ctx, http_etag_alloc_mhash_digest); @@ -144,13 +146,13 @@ static inline void _http_etag_update(void *ctx, const char *data_ptr, size_t dat break; case HTTP_ETAG_MD5: -#ifndef HAVE_LIBMHASH +#ifndef HTTP_HAVE_MHASH default: #endif PHP_MD5Update(ctx, (const unsigned char *) data_ptr, data_len); break; -#ifdef HAVE_LIBMHASH +#ifdef HTTP_HAVE_MHASH default: mhash(ctx, data_ptr, data_len); break;