diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-05-12 08:39:03 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-05-12 08:39:03 +0000 |
commit | 6a7a4a09d9217dbe071475c1d7edbd282339eb27 (patch) | |
tree | 8904af1a2b2e14980c0c61dd776e3b8d945adcf4 | |
parent | 2ef02113467afb1cdd4670dc16578549839c1d55 (diff) |
removed some alloca() calls.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2875 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/prefs_ui.c | 29 |
2 files changed, 17 insertions, 16 deletions
@@ -1,5 +1,9 @@ 2011-05-12 + * src/prefs_ui.c: removed alloca() calls. + +2011-05-12 + * libsylph/prefs.h libsylph/account.c src/account_dialog.c: increased the prefs buffer size from 1024 diff --git a/src/prefs_ui.c b/src/prefs_ui.c index 5984d6c3..1e718467 100644 --- a/src/prefs_ui.c +++ b/src/prefs_ui.c @@ -337,8 +337,7 @@ void prefs_set_data_from_text(PrefParam *pparam) break; } - Xalloca(tmpp = tmp, strlen(text) * 2 + 1, - { *str = NULL; break; }); + tmpp = tmp = g_malloc(strlen(text) * 2 + 1); while (*tp) { if (*tp == '\n') { *tmpp++ = '\\'; @@ -348,7 +347,7 @@ void prefs_set_data_from_text(PrefParam *pparam) *tmpp++ = *tp++; } *tmpp = '\0'; - *str = g_strdup(tmp); + *str = tmp; g_free(text); break; default: @@ -374,27 +373,25 @@ void prefs_set_text(PrefParam *pparam) case P_STRING: str = (gchar **)pparam->data; if (*str) { - bufp = buf = alloca(strlen(*str) + 1); - if (!buf) buf = ""; - else { - sp = *str; - while (*sp) { - if (*sp == '\\' && *(sp + 1) == 'n') { - *bufp++ = '\n'; - sp += 2; - } else - *bufp++ = *sp++; - } - *bufp = '\0'; + bufp = buf = g_malloc(strlen(*str) + 1); + sp = *str; + while (*sp) { + if (*sp == '\\' && *(sp + 1) == 'n') { + *bufp++ = '\n'; + sp += 2; + } else + *bufp++ = *sp++; } + *bufp = '\0'; } else - buf = ""; + buf = g_strdup(""); text = GTK_TEXT_VIEW(*ui_data->widget); buffer = gtk_text_view_get_buffer(text); gtk_text_buffer_set_text(buffer, "", 0); gtk_text_buffer_get_start_iter(buffer, &iter); gtk_text_buffer_insert(buffer, &iter, buf, -1); + g_free(buf); break; default: g_warning("Invalid PrefType for GtkTextView widget: %d\n", |