1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Use charpool for service names

Small strings have greater malloc alignment overhead which we save
(~300KB) with this method. string_pool was a slight memory savings but
greater computational cost due to memory overhead and insertion
calculation.
This commit is contained in:
dmiller
2022-09-19 17:51:46 +00:00
parent 00c493485c
commit e319c6d519
2 changed files with 7 additions and 18 deletions

View File

@@ -155,7 +155,7 @@ class ServiceProbeMatch {
private:
int deflineno; // The line number where this match is defined.
bool isInitialized; // Has InitMatch yet been called?
char *servicename;
const char *servicename;
char *matchstr; // Regular expression text
pcre *regex_compiled;
pcre_extra *regex_extra;
@@ -277,9 +277,9 @@ class ServiceProbe {
private:
void setPortVector(std::vector<u16> *portv, const char *portstr,
int lineno);
char *probename;
const char *probename;
u8 *probestring;
const u8 *probestring;
int probestringlen;
std::vector<u16> probableports;
std::vector<u16> probablesslports;