On Tue, Mar 29, 2016 at 12:05:19PM +0200, Neels Hofmeyr wrote:
On Sun, Mar 27, 2016 at 10:26:53AM +0200, Harald Welte
wrote:
theoretically, there could also be a 'c'
where the accessor function is an
inline function or a macro, as it basicall is just a one-liner.
I tend to use static inline functions with a switch(){} (I recently
submitted a patch like that in "[PATCH 1/7] Add MM Auth test; add
auth_action_str() function").
Yes, and AFAIR I already provided feedback about this particular issues.
Is the get_value_string() way preferred to a switch?
yes, it is the general way how we map numbers to ascii strings and
vice-versa. It is not as effcient as it iterates the list, but
* as it is used for debug statements and from VTY, performance is not
the utmost concern
* I prefer to have one way that all code uses over everyone inventing
their own methods. That helps in terms of reducing code duplication
and also helps if we ever want to migrate to something more efficient
(wireshark is the source of value_string, and they have a hashed
version now, AFAIK).
Regards,
Harald
--
- Harald Welte <laforge(a)gnumonks.org>
http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)