aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2011-05-13 06:23:52 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2011-05-13 06:23:52 +0000
commit04fe3ea9febf61f25bfc9f3cdf07dc9a452d8660 (patch)
tree2eeb4403b881eb22b6ca776c91cf97717d4a3396
parentd76e8d5af5bc66a10d7cfa79ae75e61e7df15024 (diff)
libsylph/procheader.c: removed alloca() calls.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2878 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog1
-rw-r--r--libsylph/procheader.c18
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);