build and file maintenance
[m6w6/ext-http] / php_http_params.c
index 2cc9a0912ffee8d4eddfe012e8c3a54f68657f80..4e34ee3f1d5b08dce441d1159853d56be955c41a 100644 (file)
@@ -6,17 +6,14 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2011, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
-/* $Id: http_api.c 300299 2010-06-09 06:23:16Z mike $ */
-
 #include "php_http.h"
 
 PHP_HTTP_API void php_http_params_parse_default_func(void *arg, const char *key, int keylen, const char *val, int vallen TSRMLS_DC)
 {
-       char *kdup;
        zval tmp, *entry;
        HashTable *ht = (HashTable *) arg;
 
@@ -27,15 +24,13 @@ PHP_HTTP_API void php_http_params_parse_default_func(void *arg, const char *key,
                        MAKE_STD_ZVAL(entry);
                        array_init(entry);
                        if (keylen) {
-                               kdup = estrndup(key, keylen);
-                               add_assoc_stringl_ex(entry, kdup, keylen + 1, (char *) val, vallen, 1);
-                               efree(kdup);
+                               add_assoc_stringl_ex(entry, key, keylen + 1, estrndup(val, vallen), vallen, 0);
                        } else {
-                               add_next_index_stringl(entry, (char *) val, vallen, 1);
+                               add_next_index_stringl(entry, val, vallen, 1);
                        }
                        add_next_index_zval(&tmp, entry);
                } else {
-                       add_next_index_stringl(&tmp, (char *) key, keylen, 1);
+                       add_next_index_stringl(&tmp, key, keylen, 1);
                }
        }
 }
@@ -132,6 +127,7 @@ PHP_HTTP_API STATUS php_http_params_parse(const char *param, int flags, php_http
                                                if (flags & PHP_HTTP_PARAMS_ALLOW_COMMA) {
                                                        goto add;
                                                }
+                                               /* fallthrough */
                                        default:
                                                if (!val) {
                                                        val = c;
@@ -146,6 +142,7 @@ PHP_HTTP_API STATUS php_http_params_parse(const char *param, int flags, php_http
                                                if (flags & PHP_HTTP_PARAMS_ALLOW_COMMA) {
                                                        goto allow_comma;
                                                }
+                                               /* fallthrough */
                                        case '\r':
                                        case '\n':
                                        case '\t':