static gint compose_exec_ext_editor_real(const gchar *file, GdkNativeWindow socket_wid)
{
- gchar buf[1024];
+ gchar *buf;
gchar *p, *s;
gchar **cmdline;
pid_t pid;
s = strstr(p, "%w");
s[1] = 'u';
if (strstr(p, "%s") < s)
- g_snprintf(buf, sizeof(buf), p, file, socket_wid);
+ buf = g_strdup_printf(p, file, socket_wid);
else
- g_snprintf(buf, sizeof(buf), p, socket_wid, file);
+ buf = g_strdup_printf(p, socket_wid, file);
g_free(p);
} else {
- g_snprintf(buf, sizeof(buf),
- prefs_common_get_ext_editor_cmd(), file);
+ buf = g_strdup_printf(prefs_common_get_ext_editor_cmd(), file);
}
} else {
if (prefs_common_get_ext_editor_cmd())
g_warning("External editor command-line is invalid: '%s'",
prefs_common_get_ext_editor_cmd());
- g_snprintf(buf, sizeof(buf), DEFAULT_EDITOR_CMD, file);
+ buf = g_strdup_printf(DEFAULT_EDITOR_CMD, file);
}
- cmdline = strsplit_with_quote(buf, " ", 1024);
+ cmdline = strsplit_with_quote(buf, " ", 0);
+ g_free(buf);
execvp(cmdline[0], cmdline);
perror("execvp");
#include <errno.h>
#include <stdio.h> /* for printf */
#include <stdarg.h> /* for va_list, va_start, etc. */
-
-#define TMP_BUF_SIZE 1024
+
+#define BUF_SIZE 1024
/* Private routines for icalproperty */
void icalvalue_set_parent(icalvalue* value,
icalproperty* icalproperty_new_from_string(char* str)
{
- size_t buf_size = 1024;
+ size_t buf_size = BUF_SIZE;
char* buf;
char* buf_ptr;
icalproperty *prop;
the caller forgetting to free it */
const char* property_name = 0;
- size_t buf_size = 1024;
+ size_t buf_size = BUF_SIZE;
char* buf;
char* buf_ptr;
icalvalue* value;
}
if (kind_string == 0 ) {
- char temp[TMP_BUF_SIZE];
- snprintf(temp, TMP_BUF_SIZE,"Got a parameter of unknown kind in %s property",property_name);
+ char *temp;
+ temp = g_strdup_printf(temp, "Got a parameter of unknown kind in %s property", property_name);
icalerror_warn(temp);
+ g_free(temp);
continue;
}