From 9f4665ecd783e653577610d9964532849cdece6b Mon Sep 17 00:00:00 2001 From: nagappan Date: Thu, 28 Jul 2005 08:32:42 +0000 Subject: Converted all asprintf to g_strdup_printf mainly to work with solaris platform --- ChangeLog | 2 ++ parser.c | 51 +++++++++++++++++++++++++++------------------------ 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index e69de29..86dcc5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -0,0 +1,2 @@ +2005-07-28 Nagappan A + * Converted all asprintf to g_strdup_printf mainly to work with solaris platform diff --git a/parser.c b/parser.c index d5c2742..ad4adb2 100644 --- a/parser.c +++ b/parser.c @@ -64,37 +64,37 @@ void reset_count() label = -1; } -char *get_prefix(char *role) +gchar *get_prefix(char *role) { - char *prefix = NULL; + gchar *prefix = NULL; if (strcasecmp(role, "page tab" ) == 0) - asprintf(&prefix, "%s","ptab"); + prefix = g_strdup_printf ("%s", "ptab"); if (strcasecmp(role, "page tab list" ) == 0) - asprintf(&prefix, "%s","ptl"); + prefix = g_strdup_printf ("%s", "ptl"); if (strcasecmp(role, "table" ) == 0) - asprintf(&prefix, "%s","tbl"); + prefix = g_strdup_printf ("%s", "tbl"); if (strcasecmp(role, "combo box" ) == 0) - asprintf(&prefix, "%s","cbo"); + prefix = g_strdup_printf ("%s", "cbo"); if (strcasecmp(role, "spin button" ) == 0) - asprintf(&prefix, "%s","sbtn"); + prefix = g_strdup_printf ("%s", "sbtn"); if (strcasecmp(role, "font chooser" ) == 0) - asprintf(&prefix, "%s","dlg"); + prefix = g_strdup_printf ("%s", "dlg"); if (strcasecmp(role, "radio button" ) == 0) - asprintf(&prefix, "%s","rbtn"); + prefix = g_strdup_printf ("%s", "rbtn"); if (strcasecmp(role, "tree table" ) == 0) - asprintf(&prefix, "%s","ttbl"); + prefix = g_strdup_printf ("%s", "ttbl"); if (strcasecmp(role, "layered pane" ) == 0) - asprintf(&prefix, "%s","pane"); + prefix = g_strdup_printf ("%s", "pane"); if (strcasecmp(role, "frame" ) == 0) - asprintf(&prefix, "%s",""); + prefix = g_strdup_printf ("%s", "frm"); if (strcasecmp(role, "dialog" ) == 0) - asprintf(&prefix, "%s","dlg"); + prefix = g_strdup_printf ("%s", "dlg"); if (strcasecmp(role, "Calendar view" ) == 0) - asprintf(&prefix, "%s","calview"); + prefix = g_strdup_printf ("%s", "calview"); if (strcasecmp(role, "panel" ) == 0) - asprintf(&prefix, "%s","pnl"); + prefix = g_strdup_printf ("%s", "pnl"); if (strcasecmp(role, "label" ) == 0) - asprintf(&prefix, "%s","lbl"); + prefix = g_strdup_printf ("%s", "lbl"); return prefix; } @@ -150,9 +150,10 @@ static int add_object_model_type (FILE *fp, char *name, char *object_type, Acces data = strip_white_space (name); else data = strdup (name); - size = asprintf (&str_format, "[%s]\n%s", - data, - data); + str_format = g_strdup_printf ("[%s]\n%s", + data, + data); + size = strlen (str_format); free (data); #ifdef DEBUG printf ("%s", str_format); @@ -165,9 +166,10 @@ static int add_object_model_type (FILE *fp, char *name, char *object_type, Acces int size = 0; char *str_format = NULL; - size = asprintf (&str_format, "[%s]\n%s", - application_name, - application_name); + str_format = g_strdup_printf ("[%s]\n%s", + application_name, + application_name); + size = strlen (str_format); #ifdef DEBUG printf ("%s", str_format); #endif @@ -175,8 +177,9 @@ static int add_object_model_type (FILE *fp, char *name, char *object_type, Acces free (str_format); } - size = asprintf (&str_format, "={class=frame, app_name=%s}\n", - application_name); + str_format = g_strdup_printf ("={class=frame, app_name=%s}\n", + application_name); + size = strlen (str_format); #ifdef DEBUG printf ("%s", str_format); -- cgit v1.2.3