1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 08:13:14 +02:00

core, irc, xfer: display more information in memory allocation errors (issue #573)

This commit is contained in:
Sébastien Helleu
2016-05-27 20:13:35 +02:00
parent 7b053b7c40
commit 7342a47de0
19 changed files with 148 additions and 85 deletions
+12 -8
View File
@@ -239,8 +239,9 @@ COMMAND_CALLBACK(bar)
if (!str_type)
{
gui_chat_printf (NULL,
_("%sNot enough memory"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
_("%sNot enough memory (%s)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"/bar");
return WEECHAT_RC_OK;
}
type = gui_bar_search_type (str_type);
@@ -5081,8 +5082,9 @@ COMMAND_CALLBACK(repeat)
if (!repeat_args)
{
gui_chat_printf (NULL,
_("%sNot enough memory"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
_("%sNot enough memory (%s)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"/repeat");
return WEECHAT_RC_OK;
}
repeat_args[0] = strdup (buffer->full_name);
@@ -6040,8 +6042,9 @@ COMMAND_CALLBACK(upgrade)
if (!ptr_binary && !quit)
{
gui_chat_printf (NULL,
_("%sNot enough memory"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
_("%sNot enough memory (%s)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"/upgrade");
return WEECHAT_RC_OK;
}
@@ -6400,8 +6403,9 @@ COMMAND_CALLBACK(wait)
if (!timer_args)
{
gui_chat_printf (NULL,
_("%sNot enough memory"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
_("%sNot enough memory (%s)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"/wait");
return WEECHAT_RC_OK;
}
timer_args[0] = strdup (buffer->full_name);
+4 -4
View File
@@ -1609,7 +1609,7 @@ network_connect_child_read_cb (const void *pointer, void *data, int fd)
(hook_connect->callback_pointer,
hook_connect->callback_data,
WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
0, sock, cb_error, cb_ip_address);
0, sock, "child_read_cb", NULL);
unhook (hook_connect);
}
@@ -1695,7 +1695,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
(hook_connect->callback_pointer,
hook_connect->callback_data,
WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
0, -1, NULL, NULL);
0, -1, "pipe", NULL);
unhook (hook_connect);
return;
}
@@ -1710,7 +1710,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
(hook_connect->callback_pointer,
hook_connect->callback_data,
WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
0, -1, NULL, NULL);
0, -1, "socketpair", NULL);
unhook (hook_connect);
return;
}
@@ -1732,7 +1732,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
(hook_connect->callback_pointer,
hook_connect->callback_data,
WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
0, -1, NULL, NULL);
0, -1, "fork", NULL);
unhook (hook_connect);
return;
/* child process */
+9 -6
View File
@@ -3618,8 +3618,9 @@ irc_server_connect_cb (const void *pointer, void *data,
case WEECHAT_HOOK_CONNECT_MEMORY_ERROR:
weechat_printf (
server->buffer,
_("%s%s: not enough memory"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
_("%s%s: not enough memory (%s)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
(error) ? error : "-");
if (error && error[0])
{
weechat_printf (
@@ -3939,8 +3940,9 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
{
weechat_printf (
server->buffer,
_("%s%s: not enough memory"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
_("%s%s: not enough memory (%s)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"fingerprint");
}
}
@@ -4432,8 +4434,9 @@ irc_server_connect (struct t_irc_server *server)
{
weechat_printf (
server->buffer,
_("%s%s: not enough memory"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
_("%s%s: not enough memory (%s)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
"proxy");
return 0;
}
snprintf (option_name, length, "weechat.proxy.%s.type", proxy);
+3 -2
View File
@@ -620,8 +620,9 @@ xfer_network_connect_chat_recv_cb (const void *pointer, void *data,
break;
case WEECHAT_HOOK_CONNECT_MEMORY_ERROR:
weechat_printf (NULL,
_("%s%s: not enough memory"),
weechat_prefix ("error"), XFER_PLUGIN_NAME);
_("%s%s: not enough memory (%s)"),
weechat_prefix ("error"), XFER_PLUGIN_NAME,
(error) ? error : "-");
break;
case WEECHAT_HOOK_CONNECT_TIMEOUT:
weechat_printf (NULL,
+6 -4
View File
@@ -1119,16 +1119,18 @@ xfer_add_cb (const void *pointer, void *data,
if (!path)
{
weechat_printf (NULL,
_("%s%s: not enough memory"),
weechat_prefix ("error"), XFER_PLUGIN_NAME);
_("%s%s: not enough memory (%s)"),
weechat_prefix ("error"), XFER_PLUGIN_NAME,
"xfer_add, path");
goto error;
}
filename2 = malloc (strlen (path) + strlen (filename) + 4);
if (!filename2)
{
weechat_printf (NULL,
_("%s%s: not enough memory"),
weechat_prefix ("error"), XFER_PLUGIN_NAME);
_("%s%s: not enough memory (%s)"),
weechat_prefix ("error"), XFER_PLUGIN_NAME,
"xfer_add, filename2");
free (path);
goto error;
}