[Pkg-gnupg-commit] [gnupg2] 223/292: gpgscm: Fix error message.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Nov 21 06:31:45 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gnupg2.
commit d4454837cd60981c2863955b11c9e1cc8f9e3833
Author: Justus Winter <justus at g10code.com>
Date: Tue Nov 8 14:47:43 2016 +0100
gpgscm: Fix error message.
* tests/gpgscm/ffi.c (do_wait_processes): Fix and improve error
messages.
Signed-off-by: Justus Winter <justus at g10code.com>
---
tests/gpgscm/ffi.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c
index d4bf3ef..add82f7 100644
--- a/tests/gpgscm/ffi.c
+++ b/tests/gpgscm/ffi.c
@@ -48,6 +48,20 @@
#include "ffi.h"
#include "ffi-private.h"
+/* For use in nice error messages. */
+static const char *
+ordinal_suffix (int n)
+{
+ switch (n)
+ {
+ case 1: return "st";
+ case 2: return "nd";
+ case 3: return "rd";
+ default: return "th";
+ }
+ assert (! "reached");
+}
+
int
@@ -827,17 +841,19 @@ do_wait_processes (scheme *sc, pointer args)
err = ffi_list2argv (sc, list_names, &names, &count);
if (err == gpg_error (GPG_ERR_INV_VALUE))
- return ffi_sprintf (sc, "%luth element of first argument is "
+ return ffi_sprintf (sc, "%lu%s element of first argument is "
"neither string nor symbol",
- (unsigned long) count);
+ (unsigned long) count,
+ ordinal_suffix ((int) count));
if (err)
FFI_RETURN_ERR (sc, err);
err = ffi_list2intv (sc, list_pids, (int **) &pids, &count);
if (err == gpg_error (GPG_ERR_INV_VALUE))
- return ffi_sprintf (sc, "%luth element of second argument is "
- "neither string nor symbol",
- (unsigned long) count);
+ return ffi_sprintf (sc, "%lu%s element of second argument is "
+ "not a number",
+ (unsigned long) count,
+ ordinal_suffix ((int) count));
if (err)
FFI_RETURN_ERR (sc, err);
@@ -995,19 +1011,6 @@ do_file_equal (scheme *sc, pointer args)
goto out;
}
-static const char *
-ordinal_suffix (int n)
-{
- switch (n)
- {
- case 1: return "st";
- case 2: return "nd";
- case 3: return "rd";
- default: return "th";
- }
- assert (! "reached");
-}
-
static pointer
do_splice (scheme *sc, pointer args)
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list