[seed] Update modules to use pformat strings for exceptions
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] Update modules to use pformat strings for exceptions
- Date: Wed, 29 Apr 2009 17:40:16 -0400 (EDT)
commit fde8b28afa4dd34d02498831eb8d203b7e1c6630
Author: Robert Carr <racarr svn gnome org>
Date: Wed Apr 29 17:33:50 2009 -0400
Update modules to use pformat strings for exceptions
---
libseed/seed.h | 2 +-
modules/os/os.c | 4 +---
modules/readline/seed-readline.c | 16 ++++++----------
modules/sqlite/seed-sqlite.c | 3 ++-
4 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/libseed/seed.h b/libseed/seed.h
index 74c3dd0..d70f65d 100644
--- a/libseed/seed.h
+++ b/libseed/seed.h
@@ -86,7 +86,7 @@ SeedScript *seed_make_script (SeedContext ctx,
SeedScript *seed_script_new_from_file (SeedContext ctx, gchar * file);
SeedException seed_script_exception (SeedScript * s);
void seed_make_exception (SeedContext ctx, SeedException exception,
- const gchar * name, const gchar * message, ...);
+ const gchar * name, const gchar * message, ...) G_GNUC_PRINTF (4,5);
gchar *seed_exception_get_name (SeedContext ctx, SeedException exception);
gchar *seed_exception_get_message (SeedContext ctx, SeedException exception);
guint seed_exception_get_line (SeedContext ctx, SeedException exception);
diff --git a/modules/os/os.c b/modules/os/os.c
index 2c81952..2dd97db 100644
--- a/modules/os/os.c
+++ b/modules/os/os.c
@@ -24,9 +24,7 @@
SeedObject os_namespace;
#define EXPECTED_EXCEPTION(name, argnum) \
- gchar *mes = g_strdup_printf (name " expected " argnum " got %Zd", argument_count); \
- seed_make_exception (ctx, exception, "ArgumentError", mes); \
- g_free (mes); \
+ seed_make_exception (ctx, exception, "ArgumentError", name " expected " argnum " got %Zd", argument_count); \
return seed_make_null (ctx);
SeedValue
diff --git a/modules/readline/seed-readline.c b/modules/readline/seed-readline.c
index 884e956..5609989 100644
--- a/modules/readline/seed-readline.c
+++ b/modules/readline/seed-readline.c
@@ -56,11 +56,9 @@ seed_readline_bind(SeedContext ctx,
if (argumentCount != 2)
{
- gchar *mes =
- g_strdup_printf("Seed.readline_bind expected 2 arguments, "
- "got %Zd", argumentCount);
- seed_make_exception(ctx, exception, "ArgumentError", mes);
- g_free(mes);
+ seed_make_exception(ctx, exception, "ArgumentError",
+ "Seed.readline_bind expected 2 arguments, "
+ "got %Zd", argumentCount);
return seed_make_null(ctx);
}
@@ -95,11 +93,9 @@ seed_readline(SeedContext ctx,
if (argumentCount != 1)
{
- gchar *mes =
- g_strdup_printf("Seed.readline expected 1 argument, "
- "got %Zd", argumentCount);
- seed_make_exception(ctx, exception, "ArgumentError", mes);
- g_free(mes);
+ seed_make_exception(ctx, exception, "ArgumentError",
+ "Seed.readline expected 1 argument, "
+ "got %Zd", argumentCount);
return seed_make_null(ctx);
}
diff --git a/modules/sqlite/seed-sqlite.c b/modules/sqlite/seed-sqlite.c
index 3287c02..f940753 100644
--- a/modules/sqlite/seed-sqlite.c
+++ b/modules/sqlite/seed-sqlite.c
@@ -139,7 +139,8 @@ SeedValue seed_sqlite_exec(SeedContext ctx,
{
if (sqlite_error)
{
- seed_make_exception(ctx, exception, "SqliteError", sqlite_error);
+ seed_make_exception(ctx, exception, "SqliteError",
+ sqlite_error, NULL);
sqlite3_free(sqlite_error);
}
return seed_make_null(ctx);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]