X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_negotiate.c;h=a74875b7378647664a1fe35a63b72c8f17995d79;hp=5661a3609de57f57503568f5fcad596c977be04a;hb=046973e332c1475f9bf7717af9d33a75283deb37;hpb=40b8f999b7705c5474030aa67530a8b293f9ea8c diff --git a/php_http_negotiate.c b/php_http_negotiate.c index 5661a36..a74875b 100644 --- a/php_http_negotiate.c +++ b/php_http_negotiate.c @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2011, Michael Wallner | + | Copyright (c) 2004-2014, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -90,7 +90,7 @@ static int php_http_negotiate_reduce(void *p TSRMLS_DC, int num_args, va_list ar } } - if (q && Z_DVAL_PP(q)) { + if (q && Z_DVAL_PP(q) > 0) { Z_ADDREF_PP(q); zend_hash_update(result, Z_STRVAL_P(supported), Z_STRLEN_P(supported) + 1, (void *) q, sizeof(zval *), NULL); } @@ -99,7 +99,7 @@ static int php_http_negotiate_reduce(void *p TSRMLS_DC, int num_args, va_list ar return ZEND_HASH_APPLY_KEEP; } -PHP_HTTP_API HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable *supported, const char *primary_sep_str, size_t primary_sep_len TSRMLS_DC) +HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable *supported, const char *primary_sep_str, size_t primary_sep_len TSRMLS_DC) { HashTable *result = NULL; @@ -131,11 +131,6 @@ PHP_HTTP_API HashTable *php_http_negotiate(const char *value_str, size_t value_l q = Z_DVAL_P(tmp); zval_ptr_dtor(&tmp); - - if (0&&!q) { - STR_FREE(key.str); - continue; - } } else { q = 1.0 - ++i / 100.0; } @@ -146,7 +141,7 @@ PHP_HTTP_API HashTable *php_http_negotiate(const char *value_str, size_t value_l add_index_double(&arr, key.num, q); } - STR_FREE(key.str); + PTR_FREE(key.str); } #if 0