[seed] [modules] No more pluralization of argument count, no more asprintf
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [modules] No more pluralization of argument count, no more asprintf
- Date: Sun, 5 Jul 2009 05:57:38 +0000 (UTC)
commit 0a6091a19d52f12cddd41653441b121d534b1eca
Author: Tim Horton <hortont svn gnome org>
Date: Sun Jul 5 01:49:27 2009 -0400
[modules] No more pluralization of argument count, no more asprintf
modules/seed-module.h | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/modules/seed-module.h b/modules/seed-module.h
index 6bd267a..8f00a77 100644
--- a/modules/seed-module.h
+++ b/modules/seed-module.h
@@ -7,10 +7,6 @@
// os sandbox dbus libxml cairo]
// towards utilization of this header.
-// Pluralize an argument count ("1 argument", "2 arguments", etc), given an int
-#define PLURALIZE_ARG_COUNT(c) \
- ((c == 1) ? #c " argument" : #c " arguments")
-
// Check that the required number of arguments were passed into a seed callback.
// If this is not true, raise an exception and return null.
// This requires the callback to use "argument_count", "ctx", and "exception"
@@ -18,11 +14,9 @@
#define CHECK_ARG_COUNT(name, argnum) \
if ( argument_count != argnum ) \
{ \
- char * msg; \
- asprintf(&msg, "%s expected %s got %Zd", name, \
- PLURALIZE_ARG_COUNT(argnum), argument_count); \
- seed_make_exception (ctx, exception, "ArgumentError", "%s", msg); \
- g_free(msg); \
+ seed_make_exception (ctx, exception, "ArgumentError", \
+ "wrong number of arguments; wanted %s, got %Zd", \
+ #argnum, argument_count); \
return seed_make_undefined (ctx); \
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]