}
+void virStringListAutoFree(char ***strings)
+{
+ if (!*strings)
+ return;
+
+ virStringListFree(*strings);
+ *strings = NULL;
+}
+
+
/**
* virStringListFreeCount:
* @strings: array of strings to free
const char **src);
void virStringListFree(char **strings);
+void virStringListAutoFree(char ***strings);
void virStringListFreeCount(char **strings,
size_t count);
unsigned int *port)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+/**
+ * VIR_AUTOSTRINGLIST:
+ *
+ * Declares a NULL-terminated list of strings which will be automatically freed
+ * when the pointer goes out of scope.
+ */
+# define VIR_AUTOSTRINGLIST \
+ __attribute__((cleanup(virStringListAutoFree))) char **
+
VIR_DEFINE_AUTOPTR_FUNC(virString, virStringListFree);
#endif /* LIBVIRT_VIRSTRING_H */