summaryrefslogtreecommitdiff
path: root/lib/hash.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-04-01 01:12:32 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-04-04 15:37:37 +0200
commit4f2e348f9b42c69c480bffd0188502167cf4ad07 (patch)
tree5fb9d6c07e2488ef599cbd83396810af2212b0c9 /lib/hash.h
parente60fe20fdf94e829ba5fce33f7a9d6c281149f7d (diff)
downloadcurl-4f2e348f9b42c69c480bffd0188502167cf4ad07.tar.gz
hash: move key into hash struct to reduce mallocs
This removes one tiny malloc for each hash struct allocated. In a simple case like "curl localhost", this save three mallocs. Closes #1376
Diffstat (limited to 'lib/hash.h')
-rw-r--r--lib/hash.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/hash.h b/lib/hash.h
index 5929fc264..a345c8c87 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -58,8 +58,8 @@ struct curl_hash {
struct curl_hash_element {
void *ptr;
- char *key;
size_t key_len;
+ char key[1]; /* allocated memory following the struct */
};
struct curl_hash_iterator {