From 04fe3ea9febf61f25bfc9f3cdf07dc9a452d8660 Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 13 May 2011 06:23:52 +0000 Subject: libsylph/procheader.c: removed alloca() calls. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2878 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 1 + libsylph/procheader.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d228f6b..80f8f055 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * src/textview.c: textview_make_clickable_parts(): removed alloca() and use GSList. * src/compose.c: removed some alloca() calls. + * libsylph/procheader.c: removed alloca() calls. 2011-05-12 diff --git a/libsylph/procheader.c b/libsylph/procheader.c index 955f5a63..0c803baa 100644 --- a/libsylph/procheader.c +++ b/libsylph/procheader.c @@ -749,7 +749,7 @@ gchar *procheader_get_fromname(const gchar *str) { gchar *tmp, *name; - Xstrdup_a(tmp, str, return NULL); + tmp = g_strdup(str); if (*tmp == '\"') { extract_quote_with_escape(tmp, '\"'); @@ -767,10 +767,11 @@ gchar *procheader_get_fromname(const gchar *str) g_strstrip(tmp); } - if (*tmp == '\0') + if (*tmp == '\0') { + g_free(tmp); name = g_strdup(str); - else - name = g_strdup(tmp); + } else + name = tmp; return name; } @@ -919,9 +920,8 @@ void procheader_date_get_localtime(gchar *dest, gint len, const time_t timer) { struct tm *lt; gchar *default_format = "%y/%m/%d(%a) %H:%M"; - gchar *tmp, *buf; - - Xalloca(tmp, len + 1, dest[0] = '\0'; return;); + gchar *buf; + gchar tmp[BUFFSIZE]; lt = localtime(&timer); if (!lt) { @@ -931,9 +931,9 @@ void procheader_date_get_localtime(gchar *dest, gint len, const time_t timer) } if (prefs_common.date_format) - strftime(tmp, len, prefs_common.date_format, lt); + strftime(tmp, sizeof(tmp), prefs_common.date_format, lt); else - strftime(tmp, len, default_format, lt); + strftime(tmp, sizeof(tmp), default_format, lt); buf = conv_localetodisp(tmp, NULL); strncpy2(dest, buf, len); -- cgit v1.2.3