While the function names are more or less correct, I will need them in the next commit. So rename these into virType{From,To}String respectively. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/libvirt_private.syms | 4 ++-- src/util/virutil.c | 22 +++++++++++----------- src/util/virutil.h | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5b3da83..ee7c229 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2343,8 +2343,6 @@ virUSBDeviceSetUsedBy; # util/virutil.h virDoubleToStr; -virEnumFromString; -virEnumToString; virFindFCHostCapableVport; virFindSCSIHostByPCI; virFormatIntDecimal; @@ -2401,6 +2399,8 @@ virTristateBoolTypeFromString; virTristateBoolTypeToString; virTristateSwitchTypeFromString; virTristateSwitchTypeToString; +virTypeFromString; +virTypeToString; virUpdateSelfLastChanged; virValidateWWN; diff --git a/src/util/virutil.c b/src/util/virutil.c index cddc78a..3343e0d 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -419,7 +419,7 @@ virParseVersionString(const char *str, unsigned long *version, return 0; } -int virEnumFromString(const char *const*types, +int virTypeFromString(const char *const*types, unsigned int ntypes, const char *type) { @@ -434,6 +434,16 @@ int virEnumFromString(const char *const*types, return -1; } +const char *virTypeToString(const char *const*types, + unsigned int ntypes, + int type) +{ + if (type < 0 || type >= ntypes) + return NULL; + + return types[type]; +} + /* In case thread-safe locales are available */ #if HAVE_NEWLOCALE @@ -526,16 +536,6 @@ virFormatIntDecimal(char *buf, size_t buflen, int val) } -const char *virEnumToString(const char *const*types, - unsigned int ntypes, - int type) -{ - if (type < 0 || type >= ntypes) - return NULL; - - return types[type]; -} - /* Translates a device name of the form (regex) /^[fhv]d[a-z]+[0-9]*$/ * into the corresponding index (e.g. sda => 0, hdz => 25, vdaa => 26) * Note that any trailing string of digits is simply ignored. diff --git a/src/util/virutil.h b/src/util/virutil.h index 53025f7..648de28 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -70,11 +70,11 @@ char *virFormatIntDecimal(char *buf, size_t buflen, int val) int virDiskNameToIndex(const char* str); char *virIndexToDiskName(int idx, const char *prefix); -int virEnumFromString(const char *const*types, +int virTypeFromString(const char *const*types, unsigned int ntypes, const char *type); -const char *virEnumToString(const char *const*types, +const char *virTypeToString(const char *const*types, unsigned int ntypes, int type); @@ -82,12 +82,12 @@ const char *virEnumToString(const char *const*types, static const char *const name ## TypeList[] = { __VA_ARGS__ }; \ verify(ARRAY_CARDINALITY(name ## TypeList) == lastVal); \ const char *name ## TypeToString(int type) { \ - return virEnumToString(name ## TypeList, \ + return virTypeToString(name ## TypeList, \ ARRAY_CARDINALITY(name ## TypeList), \ type); \ } \ int name ## TypeFromString(const char *type) { \ - return virEnumFromString(name ## TypeList, \ + return virTypeFromString(name ## TypeList, \ ARRAY_CARDINALITY(name ## TypeList), \ type); \ } -- 2.4.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list