[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xstrtoll: new module

From: Jim Meyering
Subject: Re: [PATCH] xstrtoll: new module
Date: Mon, 25 Jan 2010 12:07:32 +0100

Jim Meyering wrote:
> Rich Jones wanted to use xstrtoull and/or xstrtoll in libguestfs,
> but it didn't exist yet.  So here is the new module.
> I took the opportunity to write the test using the new init.sh framework.
> A couple things can be improved:
> Currently, every test that uses init.sh must include
> tests/init.sh in the "Files:" section and must append EXEEXT and srcdir
> definitions to the TESTS_ENVIRONMENT in the "Makefile.am:" section:
>     Files:
>     tests/init.sh
>     ...
>     Makefile.am:
>     TESTS_ENVIRONMENT += EXEEXT='$(EXEEXT)' srcdir='$(srcdir)'
> Does anyone object to making gnulib-tool do those things automatically?
> The EXEEXT may appear to be unnecessary right now, but I have a patch
> (in progress) for init.sh that will make it automatically do the right
> thing even for systems that require use of an $(EXEEXT) suffix.
> Also, as I write this, I remember that the test uses these
>   +#define __spec "llu"
>   +#define __spec "lld"
> and don't know off hand if I need to depend on some module
> to ensure that they work properly.

Now that gnulib-tool guarantees a definition of EXEEXT, and I know
automake sets srcdir, I've removed the TESTS_ENVIRONMENT definition.
Thanks Bruno and Ralf.

Also, I made this change so as not to rely on %lld or %llu:

diff --git a/tests/test-xstrtoll.c b/tests/test-xstrtoll.c
index 47a552e..03dd232 100644
--- a/tests/test-xstrtoll.c
+++ b/tests/test-xstrtoll.c
@@ -1,4 +1,4 @@
 #define __xstrtol xstrtoll
 #define __strtol_t long long int
-#define __spec "lld"
+#define __spec PRId64
 #include "test-xstrtol.c"
diff --git a/tests/test-xstrtoull.c b/tests/test-xstrtoull.c
index cf6c853..cb3a91c 100644
--- a/tests/test-xstrtoull.c
+++ b/tests/test-xstrtoull.c
@@ -1,4 +1,4 @@
 #define __xstrtol xstrtoull
 #define __strtol_t unsigned long long int
-#define __spec "llu"
+#define __spec PRIu64
 #include "test-xstrtol.c"

and pushed the result.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]