sargon / ddhcpd

A distributed DHCP Daemon
GNU General Public License v3.0
31 stars 11 forks source link

chg: Use static memory buffer for MAC address conversion #39

Open BenBE opened 5 years ago

BenBE commented 5 years ago

This avoids memory allocations when trying to output the hardware MAC address in various situations.

Multiple buffers are provided to allow for multiple MAC addresses to be processed before copies need to be created.

sargon commented 5 years ago

I currently see no use case for more than one buffer. We only use this function in debug output.

BenBE commented 5 years ago

Use case is avoiding dynamic memory allocation. Also this simplifies use in code a bit as the return value can be used directly by the caller.

christf commented 5 years ago

using multiple buffers is required when logging more than one address on the same line. I am using a similar mechanism for debug output in l3roamd, allowing either 4 small buffers or one large one. It is easy to adjust. And I would defenitely keep the functionality to use multiple buffers.

It should be easy enough to increase when demand arises.

OTOH: Does the memory overhad of those 18 Bytes really justify not merging the patch set as it is?