On 05/21/2014 01:15 PM, Kieran Colford wrote: > --- > modules/streq_macros | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > create mode 100644 modules/streq_macros > > diff --git a/modules/streq_macros b/modules/streq_macros > new file mode 100644 > index 0000000..8a02ee9 > --- /dev/null > +++ b/modules/streq_macros > @@ -0,0 +1,24 @@ > +Description: > +Add the macros STREQ and STRNEQ to config.h. This adds the > +functionality that is looked for by sc_prohibit_strcmp from the > +maintainer-makefile. > + > +Files: > + > +Depends-on: > + > +configure.ac: > +AC_DEFINE([STREQ(X, Y)], [((X) != NULL && (Y) != NULL && strcmp (X, Y) == > 0)], > + [test if X and Y are not NULL and are equal])
This definition does not match the one used elsewhere in gnulib: #define STREQ(a, b) (strcmp (a, b) == 0) It evaluates its arguments more than once (which some projects may not be expecting). At least libvirt has a macro named STREQ_NULLABLE() for the purpose of comparing two pointers for string equality which allows NULL, while reserving STREQ() for guaranteed non-null pointer comparisons. Even if we want to allow for NULL, then I'd highly recommend that two null pointers should compare equal (in your implementation, STREQ(NULL, NULL) returns false). > +License: > +LGPL Any problem with making it LGPLv2+? Plain LGPL is equivalent to the current LGPL (LGPLv3+ at the moment), and locks out use from projects that are still stuck on LGPLv2. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature