SF.net SVN: geany: [2718] trunk/src/dialogs.c
ntrel at users.sourceforge.net
ntrel at xxxxx
Fri Jun 20 14:17:16 UTC 2008
Revision: 2718
http://geany.svn.sourceforge.net/geany/?rev=2718&view=rev
Author: ntrel
Date: 2008-06-20 07:17:15 -0700 (Fri, 20 Jun 2008)
Log Message:
-----------
Use stack buffers for g_vsnprintf() instead of heap allocation.
Modified Paths:
--------------
trunk/src/dialogs.c
Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c 2008-06-20 12:34:13 UTC (rev 2717)
+++ trunk/src/dialogs.c 2008-06-20 14:17:15 UTC (rev 2718)
@@ -622,7 +622,7 @@
#ifndef G_OS_WIN32
GtkWidget *dialog;
#endif
- gchar *string = g_malloc(512);
+ gchar string[512];
va_list args;
va_start(args, text);
@@ -638,7 +638,6 @@
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
#endif
- g_free(string);
}
@@ -1403,14 +1402,13 @@
gboolean dialogs_show_question(const gchar *text, ...)
{
gboolean ret = FALSE;
- gchar *string = g_malloc(512);
+ gchar string[512];
va_list args;
va_start(args, text);
g_vsnprintf(string, 511, text, args);
va_end(args);
ret = show_question(main_widgets.window, GTK_STOCK_YES, GTK_STOCK_NO, string, NULL);
- g_free(string);
return ret;
}
@@ -1421,14 +1419,13 @@
const gchar *extra_text, const gchar *main_text, ...)
{
gboolean ret = FALSE;
- gchar *string = g_malloc(512);
+ gchar string[512];
va_list args;
va_start(args, main_text);
g_vsnprintf(string, 511, main_text, args);
va_end(args);
ret = show_question(parent, yes_btn, no_btn, string, extra_text);
- g_free(string);
return ret;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list