On 21 July 2016 at 16:11, D. Hugh Redelmeier <[email protected]> wrote:
> | From: Andrew Cagney <[email protected]>
>
> | then I can display a truncated value vis:
> |
> |    strip_prefix("ESN_", enum_enum_show(ikev2_trans_type_esn_names,
> | IKEv2_ESN_DISABLED))
> |    -> "DISABLED"
>
> It seems that strip_prefix is used about 45 times.  That's often
> enough to be catered to.
>
> Idea: introduce
>
> 1) a "prefix" field into struct enum names
>
> 2) add new functions "enum_showb_short" and "enum_name_short" that
>    suppress the prefix found in struct enum names
>    Don't bother with a version of enum_show: let's not make
>    another function with confusing storage for the result

Yes.

> 3) we could add a shortbitnames function.  That would take an extra
>    argument, prefix-to-be-suppressed.  (There is no descriptor struct
>    to contain the prefix.  I guess we could add one.)

why not pass in the enum_name?  Well in truth, if the above was added
I'd likely just wrap it with an enum variant that passes in the stuff
from the enum struct.

> Is that reasonable?
> _______________________________________________
> Swan-dev mailing list
> [email protected]
> https://lists.libreswan.org/mailman/listinfo/swan-dev
_______________________________________________
Swan-dev mailing list
[email protected]
https://lists.libreswan.org/mailman/listinfo/swan-dev

Reply via email to