diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-20 23:56:50 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-30 18:09:51 +0000 |
| commit | 5e882cab8fc828de286f1ead04ff6d648f05d832 (patch) | |
| tree | 0b0d7aca697704406d64a3c9dada24a619e42ce0 /lib/strlcat.c | |
| parent | 8471aeb4f598b7368dda6bb15c2f22e33fc2fdd1 (diff) | |
*: simplify log message lookup
log.c provides functionality for associating a constant (typically a
protocol constant) with a string and finding the string given the
constant. However this is highly delicate code that is extremely prone
to stack overflows and off-by-one's due to requiring the developer to
always remember to update the array size constant and to do so correctly
which, as shown by example, is never a good idea.b
The original goal of this code was to try to implement lookups in O(1)
time without a linear search through the message array. Since this code
is used 99% of the time for debugs, it's worth the 5-6 additional cmp's
worst case if it means we avoid explitable bugs due to oversights...
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/strlcat.c')
0 files changed, 0 insertions, 0 deletions
