mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 12:23:37 +02:00
Code Cleanup:
Use g_string_append_printf() instead of g_string_sprintfa() (which is considered deprecated.) git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5003 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
32e01a5a06
commit
c561ba35e6
30 changed files with 86 additions and 86 deletions
|
|
@ -207,7 +207,7 @@ static void cmd_channel_list_joined(void)
|
|||
for (ntmp = nicklist; ntmp != NULL; ntmp = ntmp->next) {
|
||||
NICK_REC *rec = ntmp->data;
|
||||
|
||||
g_string_sprintfa(nicks, "%s ", rec->nick);
|
||||
g_string_append_printf(nicks, "%s ", rec->nick);
|
||||
}
|
||||
|
||||
if (nicks->len > 1) g_string_truncate(nicks, nicks->len-1);
|
||||
|
|
@ -235,9 +235,9 @@ static void cmd_channel_list(void)
|
|||
if (rec->autojoin)
|
||||
g_string_append(str, "autojoin, ");
|
||||
if (rec->botmasks != NULL && *rec->botmasks != '\0')
|
||||
g_string_sprintfa(str, "bots: %s, ", rec->botmasks);
|
||||
g_string_append_printf(str, "bots: %s, ", rec->botmasks);
|
||||
if (rec->autosendcmd != NULL && *rec->autosendcmd != '\0')
|
||||
g_string_sprintfa(str, "botcmd: %s, ", rec->autosendcmd);
|
||||
g_string_append_printf(str, "botcmd: %s, ", rec->autosendcmd);
|
||||
|
||||
if (str->len > 2) g_string_truncate(str, str->len-2);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_CHANSETUP_LINE,
|
||||
|
|
@ -564,7 +564,7 @@ static void cmd_names(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||
for (tmp = channels; *tmp != NULL; tmp++) {
|
||||
chanrec = channel_find(server, *tmp);
|
||||
if (chanrec == NULL)
|
||||
g_string_sprintfa(unknowns, "%s,", *tmp);
|
||||
g_string_append_printf(unknowns, "%s,", *tmp);
|
||||
else {
|
||||
fe_channels_nicklist(chanrec, flags);
|
||||
signal_stop();
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ static void event_list_subcommands(const char *command)
|
|||
if (g_strncasecmp(rec->cmd, command, len) == 0 &&
|
||||
rec->cmd[len] == ' ' &&
|
||||
strchr(rec->cmd+len+1, ' ') == NULL) {
|
||||
g_string_sprintfa(str, "%s ", rec->cmd+len+1);
|
||||
g_string_append_printf(str, "%s ", rec->cmd+len+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ static void ignore_print(int index, IGNORE_REC *rec)
|
|||
if (rec->fullword) g_string_append(options, "-full ");
|
||||
if (rec->replies) g_string_append(options, "-replies ");
|
||||
if (rec->servertag != NULL)
|
||||
g_string_sprintfa(options, "-network %s ", rec->servertag);
|
||||
g_string_append_printf(options, "-network %s ", rec->servertag);
|
||||
if (rec->pattern != NULL)
|
||||
g_string_sprintfa(options, "-pattern %s ", rec->pattern);
|
||||
g_string_append_printf(options, "-pattern %s ", rec->pattern);
|
||||
|
||||
if (options->len > 1) g_string_truncate(options, options->len-1);
|
||||
|
||||
|
|
|
|||
|
|
@ -200,11 +200,11 @@ static char *log_items_get_list(LOG_REC *log)
|
|||
for (tmp = log->items; tmp != NULL; tmp = tmp->next) {
|
||||
rec = tmp->data;
|
||||
|
||||
g_string_sprintfa(str, "%s, ", rec->name);
|
||||
g_string_append_printf(str, "%s, ", rec->name);
|
||||
}
|
||||
g_string_truncate(str, str->len-2);
|
||||
if(rec->servertag != NULL)
|
||||
g_string_sprintfa(str, " (%s)", rec->servertag);
|
||||
g_string_append_printf(str, " (%s)", rec->servertag);
|
||||
|
||||
ret = str->str;
|
||||
g_string_free(str, FALSE);
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ static void sig_message_quit(SERVER_REC *server, const char *nick,
|
|||
print_channel = rec->visible_name;
|
||||
|
||||
if (once)
|
||||
g_string_sprintfa(chans, "%s,", rec->visible_name);
|
||||
g_string_append_printf(chans, "%s,", rec->visible_name);
|
||||
else {
|
||||
window = window_item_window((WI_ITEM_REC *) rec);
|
||||
if (g_slist_find(windows, window) == NULL) {
|
||||
|
|
|
|||
|
|
@ -491,11 +491,11 @@ static void hilight_print(int index, HILIGHT_REC *rec)
|
|||
}
|
||||
|
||||
if (rec->priority != 0)
|
||||
g_string_sprintfa(options, "-priority %d ", rec->priority);
|
||||
g_string_append_printf(options, "-priority %d ", rec->priority);
|
||||
if (rec->color != NULL)
|
||||
g_string_sprintfa(options, "-color %s ", rec->color);
|
||||
g_string_append_printf(options, "-color %s ", rec->color);
|
||||
if (rec->act_color != NULL)
|
||||
g_string_sprintfa(options, "-actcolor %s ", rec->act_color);
|
||||
g_string_append_printf(options, "-actcolor %s ", rec->act_color);
|
||||
|
||||
chans = rec->channels == NULL ? NULL :
|
||||
g_strjoinv(",", rec->channels);
|
||||
|
|
|
|||
|
|
@ -226,31 +226,31 @@ static char *printtext_get_args(TEXT_DEST_REC *dest, const char *str,
|
|||
}
|
||||
case 'd': {
|
||||
int d = (int) va_arg(va, int);
|
||||
g_string_sprintfa(out, "%d", d);
|
||||
g_string_append_printf(out, "%d", d);
|
||||
break;
|
||||
}
|
||||
case 'f': {
|
||||
double f = (double) va_arg(va, double);
|
||||
g_string_sprintfa(out, "%0.2f", f);
|
||||
g_string_append_printf(out, "%0.2f", f);
|
||||
break;
|
||||
}
|
||||
case 'u': {
|
||||
unsigned int d =
|
||||
(unsigned int) va_arg(va, unsigned int);
|
||||
g_string_sprintfa(out, "%u", d);
|
||||
g_string_append_printf(out, "%u", d);
|
||||
break;
|
||||
}
|
||||
case 'l': {
|
||||
long d = (long) va_arg(va, long);
|
||||
|
||||
if (*++str != 'd' && *str != 'u') {
|
||||
g_string_sprintfa(out, "%ld", d);
|
||||
g_string_append_printf(out, "%ld", d);
|
||||
str--;
|
||||
} else {
|
||||
if (*str == 'd')
|
||||
g_string_sprintfa(out, "%ld", d);
|
||||
g_string_append_printf(out, "%ld", d);
|
||||
else
|
||||
g_string_sprintfa(out, "%lu", d);
|
||||
g_string_append_printf(out, "%lu", d);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,26 +109,26 @@ static void cmd_server_list(const char *data)
|
|||
if (rec->use_ssl) {
|
||||
g_string_append(str, "ssl, ");
|
||||
if (rec->ssl_cert) {
|
||||
g_string_sprintfa(str, "ssl_cert: %s, ", rec->ssl_cert);
|
||||
g_string_append_printf(str, "ssl_cert: %s, ", rec->ssl_cert);
|
||||
if (rec->ssl_pkey)
|
||||
g_string_sprintfa(str, "ssl_pkey: %s, ", rec->ssl_pkey);
|
||||
g_string_append_printf(str, "ssl_pkey: %s, ", rec->ssl_pkey);
|
||||
}
|
||||
if (rec->ssl_verify)
|
||||
g_string_append(str, "ssl_verify, ");
|
||||
if (rec->ssl_cafile)
|
||||
g_string_sprintfa(str, "ssl_cafile: %s, ", rec->ssl_cafile);
|
||||
g_string_append_printf(str, "ssl_cafile: %s, ", rec->ssl_cafile);
|
||||
if (rec->ssl_capath)
|
||||
g_string_sprintfa(str, "ssl_capath: %s, ", rec->ssl_capath);
|
||||
g_string_append_printf(str, "ssl_capath: %s, ", rec->ssl_capath);
|
||||
|
||||
}
|
||||
if (rec->max_cmds_at_once > 0)
|
||||
g_string_sprintfa(str, "cmdmax: %d, ", rec->max_cmds_at_once);
|
||||
g_string_append_printf(str, "cmdmax: %d, ", rec->max_cmds_at_once);
|
||||
if (rec->cmd_queue_speed > 0)
|
||||
g_string_sprintfa(str, "cmdspeed: %d, ", rec->cmd_queue_speed);
|
||||
g_string_append_printf(str, "cmdspeed: %d, ", rec->cmd_queue_speed);
|
||||
if (rec->max_query_chans > 0)
|
||||
g_string_sprintfa(str, "querychans: %d, ", rec->max_query_chans);
|
||||
g_string_append_printf(str, "querychans: %d, ", rec->max_query_chans);
|
||||
if (rec->own_host != NULL)
|
||||
g_string_sprintfa(str, "host: %s, ", rec->own_host);
|
||||
g_string_append_printf(str, "host: %s, ", rec->own_host);
|
||||
|
||||
if (str->len > 1) g_string_truncate(str, str->len-2);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_SETUPSERVER_LINE,
|
||||
|
|
|
|||
|
|
@ -45,33 +45,33 @@ static void cmd_network_list(void)
|
|||
|
||||
g_string_truncate(str, 0);
|
||||
if (rec->nick != NULL)
|
||||
g_string_sprintfa(str, "nick: %s, ", rec->nick);
|
||||
g_string_append_printf(str, "nick: %s, ", rec->nick);
|
||||
if (rec->username != NULL)
|
||||
g_string_sprintfa(str, "username: %s, ", rec->username);
|
||||
g_string_append_printf(str, "username: %s, ", rec->username);
|
||||
if (rec->realname != NULL)
|
||||
g_string_sprintfa(str, "realname: %s, ", rec->realname);
|
||||
g_string_append_printf(str, "realname: %s, ", rec->realname);
|
||||
if (rec->own_host != NULL)
|
||||
g_string_sprintfa(str, "host: %s, ", rec->own_host);
|
||||
g_string_append_printf(str, "host: %s, ", rec->own_host);
|
||||
if (rec->autosendcmd != NULL)
|
||||
g_string_sprintfa(str, "autosendcmd: %s, ", rec->autosendcmd);
|
||||
g_string_append_printf(str, "autosendcmd: %s, ", rec->autosendcmd);
|
||||
if (rec->usermode != NULL)
|
||||
g_string_sprintfa(str, "usermode: %s, ", rec->usermode);
|
||||
g_string_append_printf(str, "usermode: %s, ", rec->usermode);
|
||||
|
||||
if (rec->cmd_queue_speed > 0)
|
||||
g_string_sprintfa(str, "cmdspeed: %d, ", rec->cmd_queue_speed);
|
||||
g_string_append_printf(str, "cmdspeed: %d, ", rec->cmd_queue_speed);
|
||||
if (rec->max_cmds_at_once > 0)
|
||||
g_string_sprintfa(str, "cmdmax: %d, ", rec->max_cmds_at_once);
|
||||
g_string_append_printf(str, "cmdmax: %d, ", rec->max_cmds_at_once);
|
||||
if (rec->max_query_chans > 0)
|
||||
g_string_sprintfa(str, "querychans: %d, ", rec->max_query_chans);
|
||||
g_string_append_printf(str, "querychans: %d, ", rec->max_query_chans);
|
||||
|
||||
if (rec->max_kicks > 0)
|
||||
g_string_sprintfa(str, "max_kicks: %d, ", rec->max_kicks);
|
||||
g_string_append_printf(str, "max_kicks: %d, ", rec->max_kicks);
|
||||
if (rec->max_msgs > 0)
|
||||
g_string_sprintfa(str, "max_msgs: %d, ", rec->max_msgs);
|
||||
g_string_append_printf(str, "max_msgs: %d, ", rec->max_msgs);
|
||||
if (rec->max_modes > 0)
|
||||
g_string_sprintfa(str, "max_modes: %d, ", rec->max_modes);
|
||||
g_string_append_printf(str, "max_modes: %d, ", rec->max_modes);
|
||||
if (rec->max_whois > 0)
|
||||
g_string_sprintfa(str, "max_whois: %d, ", rec->max_whois);
|
||||
g_string_append_printf(str, "max_whois: %d, ", rec->max_whois);
|
||||
|
||||
if (str->len > 1) g_string_truncate(str, str->len-2);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP,
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ static void print_netjoins(NETJOIN_SERVER_REC *server)
|
|||
if (*channel != ' ')
|
||||
g_string_append_c(temp->nicks,
|
||||
*channel);
|
||||
g_string_sprintfa(temp->nicks, "%s, ",
|
||||
g_string_append_printf(temp->nicks, "%s, ",
|
||||
rec->nick);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ static void get_server_splits(void *key, NETSPLIT_REC *split,
|
|||
g_string_append_c(chanrec->nicks, '@');
|
||||
else if (splitchan->voice)
|
||||
g_string_append_c(chanrec->nicks, '+');
|
||||
g_string_sprintfa(chanrec->nicks, "%s, ", split->nick);
|
||||
g_string_append_printf(chanrec->nicks, "%s, ", split->nick);
|
||||
|
||||
if (chanrec->nick_count == netsplit_max_nicks)
|
||||
chanrec->maxnickpos = chanrec->nicks->len;
|
||||
|
|
@ -153,7 +153,7 @@ static void print_server_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec)
|
|||
NETSPLIT_SERVER_REC *rec = tmp->data;
|
||||
|
||||
if (rec->prints > 0) {
|
||||
g_string_sprintfa(destservers, "%s, ",
|
||||
g_string_append_printf(destservers, "%s, ",
|
||||
rec->destserver);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ static void print_notify_onserver(IRC_SERVER_REC *server, GSList *nicks,
|
|||
if (!notifylist_ison_server(server, nick))
|
||||
continue;
|
||||
|
||||
g_string_sprintfa(str, "%s, ", nick);
|
||||
g_string_append_printf(str, "%s, ", nick);
|
||||
*offline = g_slist_remove(*offline, nick);
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ static void cmd_notify_show(void)
|
|||
|
||||
str = g_string_new(NULL);
|
||||
for (tmp = offline; tmp != NULL; tmp = tmp->next)
|
||||
g_string_sprintfa(str, "%s, ", (char *) tmp->data);
|
||||
g_string_append_printf(str, "%s, ", (char *) tmp->data);
|
||||
|
||||
g_string_truncate(str, str->len-2);
|
||||
printformat(NULL,NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NOTIFY_OFFLINE, str->str);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue