diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2019-05-15 23:51:49 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2019-05-15 23:51:49 +0300 |
commit | 11350cbeafffca63ec71a93ebfa3e8a67451218d (patch) | |
tree | f24b4e432a0c4542cc1fa7bcc039c7a979abf7f1 /src/microhttpd/response.c | |
parent | 2a0871b731fb068bfab6acc04a473914149b87b0 (diff) | |
download | libmicrohttpd-11350cbeafffca63ec71a93ebfa3e8a67451218d.tar.gz libmicrohttpd-11350cbeafffca63ec71a93ebfa3e8a67451218d.zip |
More speedups by using predefined length of strings
Diffstat (limited to 'src/microhttpd/response.c')
-rw-r--r-- | src/microhttpd/response.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 7d7e899b..f43ca541 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c | |||
@@ -199,18 +199,26 @@ MHD_del_response_header (struct MHD_Response *response, | |||
199 | { | 199 | { |
200 | struct MHD_HTTP_Header *pos; | 200 | struct MHD_HTTP_Header *pos; |
201 | struct MHD_HTTP_Header *prev; | 201 | struct MHD_HTTP_Header *prev; |
202 | size_t header_len; | ||
203 | size_t content_len; | ||
202 | 204 | ||
203 | if ( (NULL == header) || | 205 | if ( (NULL == header) || |
204 | (NULL == content) ) | 206 | (NULL == content) ) |
205 | return MHD_NO; | 207 | return MHD_NO; |
208 | header_len = strlen (header); | ||
209 | content_len = strlen (content); | ||
206 | prev = NULL; | 210 | prev = NULL; |
207 | pos = response->first_header; | 211 | pos = response->first_header; |
208 | while (NULL != pos) | 212 | while (NULL != pos) |
209 | { | 213 | { |
210 | if ((0 == strcmp (header, | 214 | if ((header_len == pos->header_size) && |
211 | pos->header)) && | 215 | (content_len == pos->value_size) && |
212 | (0 == strcmp (content, | 216 | (0 == memcmp (header, |
213 | pos->value))) | 217 | pos->header, |
218 | header_len)) && | ||
219 | (0 == memcmp (content, | ||
220 | pos->value, | ||
221 | content_len))) | ||
214 | { | 222 | { |
215 | free (pos->header); | 223 | free (pos->header); |
216 | free (pos->value); | 224 | free (pos->value); |