On Wed, Mar 13, 2013 at 12:03:49PM -0400, Stefan Berger wrote:
Index: libvirt/src/util/virutil.c
===================================================================
--- libvirt.orig/src/util/virutil.c
+++ libvirt/src/util/virutil.c
@@ -3379,3 +3379,17 @@ cleanup:
VIR_FREE(buf);
return ret;
}
+
+
+bool
+virStrArrayHasString(char **strings, size_t n_strings, const char *needle)
+{
+ size_t i;
+
+ for (i = 0; i < n_strings; i++) {
+ if (STREQ(strings[i], needle))
+ return true;
+ }
+
+ return false;
+}
Index: libvirt/src/util/virutil.h
===================================================================
--- libvirt.orig/src/util/virutil.h
+++ libvirt/src/util/virutil.h
@@ -297,4 +297,7 @@ int virGetDeviceUnprivSGIO(const char *p
char * virGetUnprivSGIOSysfsPath(const char *path,
const char *sysfs_dir);
+bool virStrArrayHasString(char **strings, size_t n_strings,
+ const char *needle);
+
These shouldn't be in virutil.h - we have a virstring.h. Instead
of passing in 'n_strings', we should declare that 'strings' is
NULL terminated as we do for other string list APIs. Finally the
name should be 'virStringArrayHasString' or 'virStringArrayContains'
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|