mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Finesse allocation of memory for "struct crec" cache entries.
These normally have enough space for a name of up to SMALLDNAME characters. When used to hold /etc/hosts entries, they are allocated with just enough bytes for the name held. When used to hold other configured stuff, (CNAMES DS records. DHCP names etc), the name is replaced by a pointer to a string held elsewhere, and F_NAMEP set. Hence only enough space to hold a char * is needed, rather than SMALLDNAME bytes.
This commit is contained in:
@@ -442,6 +442,9 @@ struct crec {
|
||||
} name;
|
||||
};
|
||||
|
||||
#define SIZEOF_BARE_CREC (sizeof(struct crec) - SMALLDNAME)
|
||||
#define SIZEOF_POINTER_CREC (sizeof(struct crec) + sizeof(char *) - SMALLDNAME)
|
||||
|
||||
#define F_IMMORTAL (1u<<0)
|
||||
#define F_NAMEP (1u<<1)
|
||||
#define F_REVERSE (1u<<2)
|
||||
|
||||
Reference in New Issue
Block a user