From 2fffcf5a77167e03e267664e559267c8fa1d972d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20F=C3=A6r=C3=B8y?= Date: Sun, 8 Feb 2009 17:57:19 +0000 Subject: 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 --- src/core/servers.c | 2 +- src/core/settings.c | 2 +- src/fe-common/core/fe-messages.c | 2 +- src/fe-common/irc/fe-irc-commands.c | 4 ++-- src/irc/core/ctcp.c | 2 +- src/irc/core/irc-commands.c | 14 +++++++------- src/irc/core/modes.c | 2 +- src/irc/dcc/dcc-get.c | 2 +- src/irc/proxy/dump.c | 4 ++-- src/irc/proxy/listen.c | 2 +- src/perl/perl-common.c | 2 +- src/perl/perl-core.c | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/core/servers.c b/src/core/servers.c index 3e1d83f0..d5844e7b 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -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); diff --git a/src/core/settings.c b/src/core/settings.c index 902d4cf6..cb196bd1 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -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; diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c index 9b50c1a9..846272fd 100644 --- a/src/fe-common/core/fe-messages.c +++ b/src/fe-common/core/fe-messages.c @@ -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)); diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index 4696aba6..79b28746 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -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); diff --git a/src/irc/core/ctcp.c b/src/irc/core/ctcp.c index cc4bd6ca..06fad103 100644 --- a/src/irc/core/ctcp.c +++ b/src/irc/core/ctcp.c @@ -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; diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index e51aa111..8ee5c9bd 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -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"; } diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index 38b457a2..f204c801 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -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 { diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index 87d4cfb6..bdcd2424 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -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); diff --git a/src/irc/proxy/dump.c b/src/irc/proxy/dump.c index 17ba382d..72bc5b6c 100644 --- a/src/irc/proxy/dump.c +++ b/src/irc/proxy/dump.c @@ -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; diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c index 5f473a34..57318642 100644 --- a/src/irc/proxy/listen.c +++ b/src/irc/proxy/listen.c @@ -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, diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index de7fb2ad..4018dcb1 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -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;"); diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index bb658714..6db94e2b 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -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); -- cgit v1.2.3