-#undef CASE_HTTP_ETAG_HASH
-#define CASE_HTTP_ETAG_HASH(HASH) \
- case HTTP_ETAG_##HASH: \
- if (*((PHP_##HASH##_CTX **) ctx_ptr)) { \
- efree(*((PHP_##HASH##_CTX **) ctx_ptr)); \
- *((PHP_##HASH##_CTX **) ctx_ptr) = NULL; \
- } \
- break;
-#define http_etag_free(cp) _http_etag_free((cp) TSRMLS_CC)
-static inline void _http_etag_free(void **ctx_ptr TSRMLS_DC)
-{
- switch (HTTP_G(etag).mode)
- {
- case HTTP_ETAG_CRC32:
- if (*((uint **) ctx_ptr)) {
- efree(*((uint **) ctx_ptr));
- *((uint **) ctx_ptr) = NULL;
- }
- break;
-
-#ifdef HTTP_HAVE_HASH_EXT
- CASE_HTTP_ETAG_HASH(RIPEMD160);
- CASE_HTTP_ETAG_HASH(RIPEMD128);
- CASE_HTTP_ETAG_HASH(SHA512);
- CASE_HTTP_ETAG_HASH(SHA384);
- CASE_HTTP_ETAG_HASH(SHA256);
-#endif
- CASE_HTTP_ETAG_HASH(SHA1);
-#ifndef HTTP_HAVE_MHASH
- default:
-#endif
- CASE_HTTP_ETAG_HASH(MD5);
-
-#ifdef HTTP_HAVE_MHASH
- default:
- /* mhash gets already freed in http_etag_finish() */
- if (*((MHASH *) ctx_ptr)) {
- mhash_deinit(*((MHASH *) ctx_ptr), NULL);
- *((MHASH *) ctx_ptr) = NULL;
- }
- break;
-#endif
- }
-}
-
-#undef CASE_HTTP_ETAG_HASH
-#define CASE_HTTP_ETAG_HASH(HASH, len) \
- case HTTP_ETAG_##HASH##: \
- PHP_##HASH##Final(digest, *((PHP_##HASH##_CTX **) ctx_ptr)); \
- etag = http_etag_digest(digest, len); \
- break;