1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-19 20:59:01 +00:00

Use charpool to back string_pool

string_pool (string interning) was using STL strings with lots of extra
constructions, when all we need is a const char array. We can use
charpool for that and get all the benefits there of tightly-packed heap
allocations.
This commit is contained in:
dmiller
2022-09-12 16:59:36 +00:00
parent cc5cd5f2c6
commit 7ec32df7ea
3 changed files with 63 additions and 45 deletions

View File

@@ -66,7 +66,9 @@
#define CHARPOOL_H
void *cp_alloc(int sz);
char *cp_strdup(const char *src);
/* len does not include null terminator */
const char *cp_strndup(const char *src, int len);
const char *cp_strdup(const char *src);
void cp_free(void);