You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2018/04/22 19:36:41 UTC
svn commit: r1829799 - /httpd/httpd/trunk/server/util.c
Author: jailletc36
Date: Sun Apr 22 19:36:41 2018
New Revision: 1829799
URL: http://svn.apache.org/viewvc?rev=1829799&view=rev
Log:
Save a few cycles.
We already know the length of the string we want to copy, so use 'apr_pstrmemdup()' instead of 'apr_strdup()'.
Modified:
httpd/httpd/trunk/server/util.c
Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1829799&r1=1829798&r2=1829799&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Sun Apr 22 19:36:41 2018
@@ -2849,12 +2849,11 @@ AP_DECLARE(int) ap_parse_form_data(reque
case FORM_NAME:
if (offset < HUGE_STRING_LEN) {
if ('=' == c) {
- buffer[offset] = 0;
- offset = 0;
pair = (ap_form_pair_t *) apr_array_push(pairs);
- pair->name = apr_pstrdup(r->pool, buffer);
+ pair->name = apr_pstrmemdup(r->pool, buffer, offset);
pair->value = apr_brigade_create(r->pool, r->connection->bucket_alloc);
state = FORM_VALUE;
+ offset = 0;
}
else {
buffer[offset++] = c;