mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
Code Cleanup:
Use g_string_printf() instead of g_string_sprintf() (which is considered deprecated.) git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5004 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c561ba35e6
commit
2fffcf5a77
@ -128,7 +128,7 @@ static char *server_create_tag(SERVER_CONNECT_REC *conn)
|
||||
num = 2;
|
||||
while (server_find_tag(str->str) != NULL ||
|
||||
server_find_lookup_tag(str->str) != NULL) {
|
||||
g_string_sprintf(str, "%s%d", tag, num);
|
||||
g_string_printf(str, "%s%d", tag, num);
|
||||
num++;
|
||||
}
|
||||
g_free(tag);
|
||||
|
@ -500,7 +500,7 @@ void settings_check_module(const char *module)
|
||||
if (node == NULL) return;
|
||||
|
||||
errors = g_string_new(NULL);
|
||||
g_string_sprintf(errors, "Unknown settings in configuration "
|
||||
g_string_printf(errors, "Unknown settings in configuration "
|
||||
"file for module %s:", module);
|
||||
|
||||
count = 0;
|
||||
|
@ -576,7 +576,7 @@ static void sig_nicklist_new(CHANNEL_REC *channel, NICK_REC *nick)
|
||||
newnick = g_string_new(NULL);
|
||||
n = 2;
|
||||
do {
|
||||
g_string_sprintf(newnick, "%s%d", nickhost, n);
|
||||
g_string_printf(newnick, "%s%d", nickhost, n);
|
||||
n++;
|
||||
} while (printnick_exists(firstnick, nick, newnick->str));
|
||||
|
||||
|
@ -187,10 +187,10 @@ static void bans_ask_channel(const char *channel, IRC_SERVER_REC *server,
|
||||
GString *str;
|
||||
|
||||
str = g_string_new(NULL);
|
||||
g_string_sprintf(str, "%s b", channel);
|
||||
g_string_printf(str, "%s b", channel);
|
||||
signal_emit("command mode", 3, str->str, server, item);
|
||||
if (server->emode_known) {
|
||||
g_string_sprintf(str, "%s e", channel);
|
||||
g_string_printf(str, "%s e", channel);
|
||||
signal_emit("command mode", 3, str->str, server, item);
|
||||
}
|
||||
g_string_free(str, TRUE);
|
||||
|
@ -206,7 +206,7 @@ static void ctcp_clientinfo(IRC_SERVER_REC *server, const char *data,
|
||||
g_return_if_fail(nick != NULL);
|
||||
|
||||
str = g_string_new(NULL);
|
||||
g_string_sprintf(str, "NOTICE %s :\001CLIENTINFO", nick);
|
||||
g_string_printf(str, "NOTICE %s :\001CLIENTINFO", nick);
|
||||
for (tmp = ctcp_cmds; tmp != NULL; tmp = tmp->next) {
|
||||
CTCP_CMD_REC *rec = tmp->data;
|
||||
|
||||
|
@ -78,7 +78,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server,
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
recoded = recode_out(SERVER(server), msg, target);
|
||||
g_string_sprintf(tmpstr, "NOTICE %s :%s", target, recoded);
|
||||
g_string_printf(tmpstr, "NOTICE %s :%s", target, recoded);
|
||||
g_free(recoded);
|
||||
|
||||
irc_send_cmd_split(server, tmpstr->str, 2, server->max_msgs_in_cmd);
|
||||
@ -106,12 +106,12 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server,
|
||||
|
||||
g_strup(ctcpcmd);
|
||||
if (*ctcpdata == '\0')
|
||||
g_string_sprintf(tmpstr, "PRIVMSG %s :\001%s\001", target, ctcpcmd);
|
||||
g_string_printf(tmpstr, "PRIVMSG %s :\001%s\001", target, ctcpcmd);
|
||||
else {
|
||||
char *recoded;
|
||||
|
||||
recoded = recode_out(SERVER(server), ctcpdata, target);
|
||||
g_string_sprintf(tmpstr, "PRIVMSG %s :\001%s %s\001", target, ctcpcmd, recoded);
|
||||
g_string_printf(tmpstr, "PRIVMSG %s :\001%s %s\001", target, ctcpcmd, recoded);
|
||||
g_free(recoded);
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server,
|
||||
|
||||
g_strup(ctcpcmd);
|
||||
recoded = recode_out(SERVER(server), ctcpdata, target);
|
||||
g_string_sprintf(tmpstr, "NOTICE %s :\001%s %s\001", target, ctcpcmd, recoded);
|
||||
g_string_printf(tmpstr, "NOTICE %s :\001%s %s\001", target, ctcpcmd, recoded);
|
||||
g_free(recoded);
|
||||
|
||||
irc_send_cmd_split(server, tmpstr->str, 2, server->max_msgs_in_cmd);
|
||||
@ -194,7 +194,7 @@ static void cmd_kick(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item
|
||||
if (!ischannel(*channame)) cmd_param_error(CMDERR_NOT_JOINED);
|
||||
|
||||
recoded = recode_out(SERVER(server), reason, channame);
|
||||
g_string_sprintf(tmpstr, "KICK %s %s :%s", channame, nicks, recoded);
|
||||
g_string_printf(tmpstr, "KICK %s %s :%s", channame, nicks, recoded);
|
||||
g_free(recoded);
|
||||
|
||||
irc_send_cmd_split(server, tmpstr->str, 3, server->max_kicks_in_cmd);
|
||||
@ -415,9 +415,9 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
|
||||
|
||||
event_402 = "event 402";
|
||||
if (*qserver == '\0')
|
||||
g_string_sprintf(tmpstr, "WHOIS %s", query);
|
||||
g_string_printf(tmpstr, "WHOIS %s", query);
|
||||
else {
|
||||
g_string_sprintf(tmpstr, "WHOIS %s %s", qserver, query);
|
||||
g_string_printf(tmpstr, "WHOIS %s %s", qserver, query);
|
||||
if (g_strcasecmp(qserver, query) == 0)
|
||||
event_402 = "whois event not found";
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ void channel_set_singlemode(IRC_CHANNEL_REC *channel, const char *nicks,
|
||||
|
||||
if (num == 0)
|
||||
{
|
||||
g_string_sprintf(str, "MODE %s %s",
|
||||
g_string_printf(str, "MODE %s %s",
|
||||
channel->name, mode);
|
||||
modepos = str->len;
|
||||
} else {
|
||||
|
@ -73,7 +73,7 @@ static char *dcc_get_rename_file(const char *fname)
|
||||
newname = g_string_new(NULL);
|
||||
num = 1;
|
||||
do {
|
||||
g_string_sprintf(newname, "%s.%d", fname, num);
|
||||
g_string_printf(newname, "%s.%d", fname, num);
|
||||
num++;
|
||||
} while (stat(newname->str, &statbuf) == 0);
|
||||
|
||||
|
@ -144,7 +144,7 @@ void proxy_outserver_all_except(CLIENT_REC *client, const char *data, ...)
|
||||
static void create_names_start(GString *str, IRC_CHANNEL_REC *channel,
|
||||
CLIENT_REC *client)
|
||||
{
|
||||
g_string_sprintf(str, ":%s 353 %s %c %s :",
|
||||
g_string_printf(str, ":%s 353 %s %c %s :",
|
||||
client->proxy_address, client->nick,
|
||||
channel_mode_is_set(channel, 'p') ? '*' :
|
||||
channel_mode_is_set(channel, 's') ? '@' : '=',
|
||||
@ -270,7 +270,7 @@ void proxy_dump_data(CLIENT_REC *client)
|
||||
g_string_append_printf(paramstr, " :are supported by this server\n");
|
||||
proxy_outdata(client, "%s", paramstr->str);
|
||||
g_string_truncate(paramstr, 0);
|
||||
g_string_sprintf(paramstr, ":%s 005 %s ", client->proxy_address, client->nick);
|
||||
g_string_printf(paramstr, ":%s 005 %s ", client->proxy_address, client->nick);
|
||||
|
||||
if (*tmp == NULL || tmp[1] == NULL)
|
||||
break;
|
||||
|
@ -370,7 +370,7 @@ static void sig_incoming(IRC_SERVER_REC *server, const char *line)
|
||||
g_return_if_fail(line != NULL);
|
||||
|
||||
/* send server event to all clients */
|
||||
g_string_sprintf(next_line, "%s\n", line);
|
||||
g_string_printf(next_line, "%s\n", line);
|
||||
}
|
||||
|
||||
static void sig_server_event(IRC_SERVER_REC *server, const char *line,
|
||||
|
@ -228,7 +228,7 @@ char *perl_get_use_list(void)
|
||||
str = g_string_new(NULL);
|
||||
|
||||
use_lib = settings_get_str("perl_use_lib");
|
||||
g_string_sprintf(str, "use lib qw(%s/scripts "SCRIPTDIR" %s);",
|
||||
g_string_printf(str, "use lib qw(%s/scripts "SCRIPTDIR" %s);",
|
||||
get_irssi_dir(), use_lib);
|
||||
|
||||
g_string_append(str, "use Irssi;");
|
||||
|
@ -202,7 +202,7 @@ static char *script_data_get_name(void)
|
||||
name = g_string_new(NULL);
|
||||
n = 1;
|
||||
do {
|
||||
g_string_sprintf(name, "data%d", n);
|
||||
g_string_printf(name, "data%d", n);
|
||||
n++;
|
||||
} while (perl_script_find(name->str) != NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user