diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ltdl/m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | modules/m4.c | 6 |
3 files changed, 10 insertions, 5 deletions
@@ -1,3 +1,9 @@ +2009-03-21 Eric Blake <ebb9@byu.net> + + Use memcmp2 to simplify lexicographic comparisons. + * ltdl/m4/gnulib-cache.m4: Import memcmp2. + * modules/m4.c (dumpdef_cmp_CB): Use it. + 2009-03-19 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> Fix m4.1 build race, exposed by parallelism through GNUmakefile. diff --git a/ltdl/m4/gnulib-cache.m4 b/ltdl/m4/gnulib-cache.m4 index 9e664dab..45af3063 100644 --- a/ltdl/m4/gnulib-cache.m4 +++ b/ltdl/m4/gnulib-cache.m4 @@ -15,7 +15,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=local --lib=libgnu --source-base=gnu --m4-base=ltdl/m4 --doc-base=doc --tests-base=tests/gnu --aux-dir=build-aux --with-tests --libtool --macro-prefix=M4 assert autobuild avltree-oset binary-io clean-temp cloexec close-stream closein config-h configmake dirname error execute exit fdl-1.3 fflush filenamecat flexmember fopen fopen-safer freadptr freadseek fseeko gendocs gettext git-version-gen gnumakefile gnupload gpl-3.0 intprops memchr2 memmem mkstemp obstack obstack-printf-posix pipe progname propername quote regex regexprops-generic sprintf-posix stdbool stdlib-safer strnlen strtod strtol tempname unlocked-io vasnprintf-posix verify verror wait-process xalloc xalloc-die xmemdup0 xprintf-posix xstrndup xvasprintf-posix +# gnulib-tool --import --dir=. --local-dir=local --lib=libgnu --source-base=gnu --m4-base=ltdl/m4 --doc-base=doc --tests-base=tests/gnu --aux-dir=build-aux --with-tests --libtool --macro-prefix=M4 assert autobuild avltree-oset binary-io clean-temp cloexec close-stream closein config-h configmake dirname error execute exit fdl-1.3 fflush filenamecat flexmember fopen fopen-safer freadptr freadseek fseeko gendocs gettext git-version-gen gnumakefile gnupload gpl-3.0 intprops memchr2 memcmp2 memmem mkstemp obstack obstack-printf-posix pipe progname propername quote regex regexprops-generic sprintf-posix stdbool stdlib-safer strnlen strtod strtol tempname unlocked-io vasnprintf-posix verify verror wait-process xalloc xalloc-die xmemdup0 xprintf-posix xstrndup xvasprintf-posix # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([local]) @@ -51,6 +51,7 @@ gl_MODULES([ gpl-3.0 intprops memchr2 + memcmp2 memmem mkstemp obstack diff --git a/modules/m4.c b/modules/m4.c index 394abf3d..f3cfc94d 100644 --- a/modules/m4.c +++ b/modules/m4.c @@ -30,6 +30,7 @@ #include "execute.h" #include "memchr2.h" +#include "memcmp2.h" #include "quotearg.h" #include "stdlib--.h" #include "tempname.h" @@ -256,10 +257,7 @@ dumpdef_cmp_CB (const void *s1, const void *s2) { const m4_string *a = (const m4_string *) s1; const m4_string *b = (const m4_string *) s2; - int result = memcmp (a->str, b->str, a->len < b->len ? a->len : b->len); - if (!result) - result = a->len < b->len ? -1 : b->len < a->len; - return result; + return memcmp2 (a->str, a->len, b->str, b->len); } /* The function m4_dump_symbols () is for use by "dumpdef". It builds up a |