1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 22:21:29 +00:00

Use lookup table for 1-char strings, not std::map for string_pool.

This commit is contained in:
dmiller
2022-11-10 18:57:58 +00:00
parent 70dc5434f4
commit 1fb680b93f
3 changed files with 30 additions and 0 deletions

View File

@@ -100,6 +100,11 @@ typedef std::set<StringPoolItem> StringPool;
const char *string_pool_insert_len(const char *s, int len)
{
static StringPool pool;
if (len == 0)
return "";
else if (len == 1)
return cp_char2str(*s);
StringPoolItem spi (s, len);
StringPool::iterator it = pool.insert(spi).first;