This series adds VIR_ENUM_IMPL_LABEL and a demo conversion. VIR_ENUM_IMPL_LABEL allows passing in a string that briefly describes the value the enum represents, which we use to generate error messages for FromString and ToString function failures. This will allow us to drop a lot of code and unique strings that need translating. Patch 2 is an example usage, converting virDomainVirtType enum. It's not a full conversion for this particular enum, just a demo. The enum creation now looks like VIR_ENUM_IMPL_LABEL(virDomainVirt, "domain type", VIR_DOMAIN_VIRT_LAST, ... FromString failure reports this error for value 'zzzz' invalid argument: Unknown 'domain type' value 'zzzz' ToString failure reports this error for unknown type=83 internal error: Unknown 'domain type' internal value '83' Seems like a win to me but I'm interested in other opinions. This could also be a good BiteSizedTask for converting existing enums Cole Robinson (2): util: Add VIR_ENUM_IMPL_LABEL conf: Convert virDomainVirtType to VIR_ENUM_IMPL_LABEL src/conf/domain_conf.c | 10 ++-------- src/util/virutil.c | 20 ++++++++++++++++---- src/util/virutil.h | 15 ++++++++++----- 3 files changed, 28 insertions(+), 17 deletions(-) -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list