mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Avoid duplicating udp payloads in memory
Storing a pointer instead of the whole struct payload enables us to reuse the same struct for as many ports as the payload defines, saving memory as well as the time to copy the struct and its std::string member. This commit also avoids several copy constructions and deletions of the payload vector for each port defined in the file.
This commit is contained in:
@@ -71,8 +71,8 @@
|
||||
#define MAX_PAYLOADS_PER_PORT 0xff
|
||||
|
||||
const char *get_udp_payload(u16 dport, size_t *length, u8 index);
|
||||
const char *udp_port2payload(u16 dport, size_t *length, u8 index);
|
||||
u8 udp_payload_count(u16 dport);
|
||||
int init_payloads(void);
|
||||
void free_payloads(void);
|
||||
|
||||
#endif /* PAYLOAD_H */
|
||||
|
||||
Reference in New Issue
Block a user