[evolution] Replace alloca() with g_alloca().



commit 2db0cad78c8f91531897cc4fd857ecee7474f4df
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Dec 27 14:44:21 2009 -0500

    Replace alloca() with g_alloca().

 configure.ac                 |    5 -----
 e-util/e-alert.c             |    2 +-
 e-util/e-unicode.c           |    3 ---
 em-format/em-format.c        |    2 +-
 filter/e-filter-part.c       |    2 +-
 mail/e-mail-migrate.c        |    4 ++--
 mail/e-searching-tokenizer.c |    8 ++++----
 mail/em-account-editor.c     |    2 +-
 mail/em-folder-tree-model.c  |    2 +-
 mail/em-format-html.c        |    2 +-
 mail/mail-mt.c               |    2 +-
 mail/message-list.c          |    6 +++---
 12 files changed, 16 insertions(+), 24 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 686cc3e..4ef6e46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -387,11 +387,6 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 CFLAGS="$save_CFLAGS"
 LIBS="$save_LIBS"
 
-dnl ***********
-dnl alloca()
-dnl ***********
-AC_FUNC_ALLOCA
-
 dnl **************
 dnl waitpid() etc
 dnl **************
diff --git a/e-util/e-alert.c b/e-util/e-alert.c
index 01fade0..797ba33 100644
--- a/e-util/e-alert.c
+++ b/e-util/e-alert.c
@@ -430,7 +430,7 @@ e_alert_constructed (GObject *obj)
 	g_return_if_fail (alert_table);
 	g_return_if_fail (alert->priv->tag);
 
-	domain = alloca(strlen(alert->priv->tag)+1);
+	domain = g_alloca(strlen(alert->priv->tag)+1);
 	strcpy(domain, alert->priv->tag);
 	id = strchr(domain, ':');
 	if (id)
diff --git a/e-util/e-unicode.c b/e-util/e-unicode.c
index cc9139d..84c0a1d 100644
--- a/e-util/e-unicode.c
+++ b/e-util/e-unicode.c
@@ -29,9 +29,6 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <iconv.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
 
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
diff --git a/em-format/em-format.c b/em-format/em-format.c
index d3ab13b..305feb9 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -358,7 +358,7 @@ em_format_fallback_handler(EMFormat *emf, const gchar *mime_type)
 	else {
 		gsize len = (s-mime_type)+1;
 
-		mime = alloca(len+2);
+		mime = g_alloca(len+2);
 		strncpy(mime, mime_type, len);
 		strcpy(mime+len, "*");
 	}
diff --git a/filter/e-filter-part.c b/filter/e-filter-part.c
index e86d2fa..4e6b114 100644
--- a/filter/e-filter-part.c
+++ b/filter/e-filter-part.c
@@ -493,7 +493,7 @@ e_filter_part_expand_code (EFilterPart *part,
                            GString *out)
 {
 	const gchar *newstart, *start, *end;
-	gchar *name = alloca (32);
+	gchar *name = g_alloca (32);
 	gint len, namelen = 32;
 
 	g_return_if_fail (E_IS_FILTER_PART (part));
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index 0480532..f67ea38 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -1322,13 +1322,13 @@ get_local_store_uri (const gchar *dirname, gchar **namep, gint *indexp)
 		if (node->name && !strcmp ((gchar *)node->name, "folder")) {
 			tmp = (gchar *)xmlGetProp (node, (const guchar *)"type");
 			if (tmp) {
-				protocol = alloca(strlen(tmp)+1);
+				protocol = g_alloca(strlen(tmp)+1);
 				strcpy(protocol, tmp);
 				xmlFree(tmp);
 			}
 			tmp = (gchar *)xmlGetProp (node, (const guchar *)"name");
 			if (tmp) {
-				name = alloca(strlen(tmp)+1);
+				name = g_alloca(strlen(tmp)+1);
 				strcpy(name, tmp);
 				xmlFree(tmp);
 			}
diff --git a/mail/e-searching-tokenizer.c b/mail/e-searching-tokenizer.c
index 4a3b6a9..8920a7d 100644
--- a/mail/e-searching-tokenizer.c
+++ b/mail/e-searching-tokenizer.c
@@ -98,7 +98,7 @@ static const gchar *ignored_tags[] = {
 static gint
 ignore_tag (const gchar *tag)
 {
-	gchar *t = alloca(strlen(tag)+1), c, *out;
+	gchar *t = g_alloca(strlen(tag)+1), c, *out;
 	const gchar *in;
 	gint i;
 
@@ -163,7 +163,7 @@ struct _trie {
 static void
 dump_trie (struct _state *s, gint d)
 {
-	gchar *p = alloca(d*2+1);
+	gchar *p = g_alloca(d*2+1);
 	struct _match *m;
 
 	memset(p, ' ', d*2);
@@ -890,9 +890,9 @@ search_info_to_searcher (struct _search_info *si)
 	else
 		col = si->color;
 
-	tags = alloca(20+strlen(col));
+	tags = g_alloca(20+strlen(col));
 	sprintf(tags, "%c<font color=\"%s\">", TAG_ESCAPE, col);
-	tage = alloca(20);
+	tage = g_alloca(20);
 	sprintf(tage, "%c</font>", TAG_ESCAPE);
 
 	return searcher_new (si->flags, si->strv->len, (guchar **)si->strv->pdata, tags, tage);
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 88912a4..e3e9613 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -3153,7 +3153,7 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data)
 				emae->priv->management_set = 1;
 				tmp = e_account_get_string (account, E_ACCOUNT_ID_ADDRESS);
 				len = strlen (tmp);
-				template = alloca (len + 14);
+				template = g_alloca (len + 14);
 				strcpy (template, tmp);
 				while (e_get_account_by_name (template))
 					sprintf (template + len, " (%d)", i++);
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 545c934..c084043 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -778,7 +778,7 @@ folder_subscribed (CamelStore *store,
 		goto done;
 
 	/* get our parent folder's path */
-	dirname = alloca(strlen(fi->full_name)+1);
+	dirname = g_alloca(strlen(fi->full_name)+1);
 	strcpy(dirname, fi->full_name);
 	p = strrchr(dirname, '/');
 	if (p == NULL) {
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 86ad0a5..b9db3d1 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -2376,7 +2376,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct
 	gchar *str_field = NULL;
 	gint i;
 
-	name = alloca(strlen(header->name)+1);
+	name = g_alloca(strlen(header->name)+1);
 	strcpy(name, header->name);
 	canon_header_name (name);
 
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 3695800..4c7c049 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -854,7 +854,7 @@ op_status_exec (struct _op_status_msg *m)
 
 	data = msg->priv;
 
-	out = alloca (strlen (m->what) * 2 + 1);
+	out = g_alloca (strlen (m->what) * 2 + 1);
 	o = out;
 	p = m->what;
 	while ((c = *p++)) {
diff --git a/mail/message-list.c b/mail/message-list.c
index 49a839a..6a674be 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -4380,13 +4380,13 @@ regen_list_exec (struct _regen_list_msg *m)
 	} else if (m->hidedel) {
 		if (m->hidejunk) {
 			if (m->search) {
-				expr = alloca(strlen(m->search) + 92);
+				expr = g_alloca(strlen(m->search) + 92);
 				sprintf(expr, "(and (match-all (and (not (system-flag \"deleted\")) (not (system-flag \"junk\"))))\n %s)", m->search);
 			} else
 				expr = (gchar *) "(match-all (and (not (system-flag \"deleted\")) (not (system-flag \"junk\"))))";
 		} else {
 			if (m->search) {
-				expr = alloca(strlen(m->search) + 64);
+				expr = g_alloca(strlen(m->search) + 64);
 				sprintf(expr, "(and (match-all (not (system-flag \"deleted\")))\n %s)", m->search);
 			} else
 				expr = (gchar *) "(match-all (not (system-flag \"deleted\")))";
@@ -4394,7 +4394,7 @@ regen_list_exec (struct _regen_list_msg *m)
 	} else {
 		if (m->hidejunk) {
 			if (m->search) {
-				expr = alloca(strlen(m->search) + 64);
+				expr = g_alloca(strlen(m->search) + 64);
 				sprintf(expr, "(and (match-all (not (system-flag \"junk\")))\n %s)", m->search);
 			} else
 				expr = (gchar *) "(match-all (not (system-flag \"junk\")))";



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]