1
0
Fork 0

Remove prefs_free_string()

It just does a free.
Related to b580b9ef11
This commit is contained in:
Michael Vetter 2020-07-02 11:31:54 +02:00
parent 9774b0c550
commit e5ac12afa6
19 changed files with 138 additions and 145 deletions

View File

@ -1265,7 +1265,7 @@ cmd_disconnect(ProfWin *window, const char *const command, gchar **args)
char *theme = prefs_get_string(PREF_THEME);
if (theme) {
gboolean res = theme_load(theme, false);
prefs_free_string(theme);
g_free(theme);
if (!res) {
theme_load("default", false);
}
@ -5280,7 +5280,7 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *format = prefs_get_string(PREF_TIME_LASTACTIVITY);
cons_show("Last activity time format: '%s'.", format);
prefs_free_string(format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_LASTACTIVITY, args[2]);
@ -5299,7 +5299,7 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *format = prefs_get_string(PREF_TIME_STATUSBAR);
cons_show("Status bar time format: '%s'.", format);
prefs_free_string(format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_STATUSBAR, args[2]);
@ -5319,7 +5319,7 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *format = prefs_get_string(PREF_TIME_CONSOLE);
cons_show("Console time format: '%s'.", format);
prefs_free_string(format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CONSOLE, args[2]);
@ -5339,7 +5339,7 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *format = prefs_get_string(PREF_TIME_CHAT);
cons_show("Chat time format: '%s'.", format);
prefs_free_string(format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CHAT, args[2]);
@ -5359,7 +5359,7 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *format = prefs_get_string(PREF_TIME_MUC);
cons_show("MUC time format: '%s'.", format);
prefs_free_string(format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_MUC, args[2]);
@ -5379,7 +5379,7 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *format = prefs_get_string(PREF_TIME_CONFIG);
cons_show("config time format: '%s'.", format);
prefs_free_string(format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CONFIG, args[2]);
@ -5399,7 +5399,7 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *format = prefs_get_string(PREF_TIME_PRIVATE);
cons_show("Private chat time format: '%s'.", format);
prefs_free_string(format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_PRIVATE, args[2]);
@ -5419,7 +5419,7 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *format = prefs_get_string(PREF_TIME_XMLCONSOLE);
cons_show("XML Console time format: '%s'.", format);
prefs_free_string(format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_XMLCONSOLE, args[2]);
@ -6860,7 +6860,7 @@ cmd_plugins_sourcepath(ProfWin *window, const char *const command, gchar **args)
char *sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
if (sourcepath) {
cons_show("Current plugins sourcepath: %s", sourcepath);
prefs_free_string(sourcepath);
g_free(sourcepath);
} else {
cons_show("Plugins sourcepath not currently set.");
}
@ -6913,7 +6913,7 @@ cmd_plugins_install(ProfWin *window, const char *const command, gchar **args)
char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
if (sourcepath) {
path = strdup(sourcepath);
prefs_free_string(sourcepath);
g_free(sourcepath);
} else {
cons_show("Either a path must be provided or the sourcepath property must be set, see /help plugins");
return TRUE;
@ -6988,7 +6988,7 @@ cmd_plugins_update(ProfWin *window, const char *const command, gchar **args)
char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
if (sourcepath) {
path = strdup(sourcepath);
prefs_free_string(sourcepath);
g_free(sourcepath);
} else {
cons_show("Either a path must be provided or the sourcepath property must be set, see /help plugins");
return TRUE;
@ -7656,7 +7656,7 @@ cmd_otr_policy(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *policy = prefs_get_string(PREF_OTR_POLICY);
cons_show("OTR policy is now set to: %s", policy);
prefs_free_string(policy);
g_free(policy);
return TRUE;
}
@ -8324,7 +8324,7 @@ _cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran)
if (value) {
*ran = TRUE;
gboolean result = cmd_process_input(window, value);
prefs_free_string(value);
g_free(value);
return result;
}
@ -8818,7 +8818,7 @@ cmd_omemo_policy(ProfWin *window, const char *const command, gchar **args)
if (args[1] == NULL) {
char *policy = prefs_get_string(PREF_OMEMO_POLICY);
cons_show("OMEMO policy is now set to: %s", policy);
prefs_free_string(policy);
g_free(policy);
return TRUE;
}
@ -8947,7 +8947,7 @@ cmd_color(ProfWin *window, const char *const command, gchar **args)
theme_load("default", false);
}
prefs_free_string(theme);
g_free(theme);
}
return TRUE;

View File

@ -104,7 +104,7 @@ static void _prefs_load(void)
char *message = g_key_file_get_string(prefs, PREF_GROUP_PRESENCE, "autoaway.message", NULL);
g_key_file_set_string(prefs, PREF_GROUP_PRESENCE, "autoaway.awaymessage", message);
g_key_file_remove_key(prefs, PREF_GROUP_PRESENCE, "autoaway.message", NULL);
prefs_free_string(message);
g_free(message);
}
// migrate pre 0.5.0 time settings
@ -123,7 +123,7 @@ static void _prefs_load(void)
g_key_file_set_string(prefs, PREF_GROUP_UI, "time.private", val);
g_key_file_set_string(prefs, PREF_GROUP_UI, "time.xmlconsole", val);
g_key_file_remove_key(prefs, PREF_GROUP_UI, "time", NULL);
prefs_free_string(time);
g_free(time);
}
// move pre 0.5.0 notify settings
@ -137,7 +137,7 @@ static void _prefs_load(void)
g_key_file_set_boolean(prefs, PREF_GROUP_NOTIFICATIONS, "room", FALSE);
g_key_file_set_boolean(prefs, PREF_GROUP_NOTIFICATIONS, "room.mention", TRUE);
}
prefs_free_string(value);
g_free(value);
}
// move pre 0.6.0 titlebar settings to wintitle
@ -569,12 +569,6 @@ prefs_get_string_list_with_option(preference_t pref, gchar *option)
}
}
void
prefs_free_string(char *pref)
{
g_free(pref);
}
void
prefs_set_string(preference_t pref, char *value)
{
@ -632,7 +626,7 @@ prefs_get_tls_certpath(void)
char *setting = g_key_file_get_string(prefs, group, key, NULL);
if (g_strcmp0(setting, "none") == 0) {
prefs_free_string(setting);
g_free(setting);
return NULL;
}
@ -657,7 +651,7 @@ prefs_get_tls_certpath(void)
}
char *result = strdup(setting);
prefs_free_string(setting);
g_free(setting);
return result;
}

View File

@ -320,7 +320,6 @@ void prefs_set_boolean(preference_t pref, gboolean value);
char* prefs_get_string(preference_t pref);
char* prefs_get_string_with_option(preference_t pref, gchar *option);
gchar **prefs_get_string_list_with_option(preference_t pref, gchar *option);
void prefs_free_string(char *pref);
void prefs_set_string(preference_t pref, char *value);
void prefs_set_string_with_option(preference_t pref, char *option, char *value);
void prefs_set_string_list_with_option(preference_t pref, char *option, const gchar* const *values);

View File

@ -708,7 +708,7 @@ theme_hash_attrs(const char *str)
} else if (strcmp(color_pref, "blue") == 0) {
profile = COLOR_PROFILE_BLUE_BLINDNESS;
}
prefs_free_string(color_pref);
g_free(color_pref);
return COLOR_PAIR(color_pair_cache_hash_str(str, profile));
}

View File

@ -156,7 +156,7 @@ sv_ev_roster_received(void)
char *theme = prefs_get_string(PREF_THEME);
win_clear(win);
theme_init(theme);
prefs_free_string(theme);
g_free(theme);
ui_resize();
ui_show_roster();
}
@ -859,7 +859,7 @@ sv_ev_room_occupant_offline(const char *const room, const char *const nick,
if (mucwin && (g_strcmp0(muc_status_pref, "none") != 0)) {
mucwin_occupant_offline(mucwin, nick);
}
prefs_free_string(muc_status_pref);
g_free(muc_status_pref);
Jid *jidp = jid_create_from_bare_and_resource(room, nick);
ProfPrivateWin *privwin = wins_get_private(jidp->fulljid);
@ -1076,7 +1076,7 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
if (mucwin && g_strcmp0(muc_status_pref, "none") != 0) {
mucwin_occupant_online(mucwin, nick, role, affiliation, show, status);
}
prefs_free_string(muc_status_pref);
g_free(muc_status_pref);
if (mucwin) {
Jid *jidp = jid_create_from_bare_and_resource(mucwin->roomjid, nick);
@ -1099,7 +1099,7 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
if (mucwin && (g_strcmp0(muc_status_pref, "all") == 0)) {
mucwin_occupant_presence(mucwin, nick, show, status);
}
prefs_free_string(muc_status_pref);
g_free(muc_status_pref);
occupantswin_occupants(room);
// presence unchanged, check for role/affiliation change
@ -1202,7 +1202,7 @@ sv_ev_lastactivity_response(const char *const from, const int seconds, const cha
gchar *date_fmt = NULL;
char *time_pref = prefs_get_string(PREF_TIME_LASTACTIVITY);
date_fmt = g_date_time_format(active, time_pref);
prefs_free_string(time_pref);
g_free(time_pref);
assert(date_fmt != NULL);
// full jid - last activity

View File

@ -307,7 +307,7 @@ chat_log_otr_msg_out(const char *const barejid, const char *const msg, const cha
} else if (strcmp(pref_otr_log, "redact") == 0) {
_chat_log_chat(mybarejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, resource);
}
prefs_free_string(pref_otr_log);
g_free(pref_otr_log);
free(mybarejid);
}
}
@ -323,7 +323,7 @@ chat_log_pgp_msg_out(const char *const barejid, const char *const msg, const cha
} else if (strcmp(pref_pgp_log, "redact") == 0) {
_chat_log_chat(mybarejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, resource);
}
prefs_free_string(pref_pgp_log);
g_free(pref_pgp_log);
free(mybarejid);
}
}
@ -339,7 +339,7 @@ chat_log_omemo_msg_out(const char *const barejid, const char *const msg, const c
} else if (strcmp(pref_omemo_log, "redact") == 0) {
_chat_log_chat(mybarejid, barejid, "[redacted]", PROF_OUT_LOG, NULL, resource);
}
prefs_free_string(pref_omemo_log);
g_free(pref_omemo_log);
free(mybarejid);
}
}
@ -363,7 +363,7 @@ chat_log_otr_msg_in(ProfMessage *message)
_chat_log_chat(mybarejid, message->from_jid->barejid, "[redacted]", PROF_IN_LOG, message->timestamp, NULL);
}
}
prefs_free_string(pref_otr_log);
g_free(pref_otr_log);
free(mybarejid);
}
}
@ -387,7 +387,7 @@ chat_log_pgp_msg_in(ProfMessage *message)
_chat_log_chat(mybarejid, message->from_jid->barejid, "[redacted]", PROF_IN_LOG, message->timestamp, NULL);
}
}
prefs_free_string(pref_pgp_log);
g_free(pref_pgp_log);
free(mybarejid);
}
}
@ -411,7 +411,7 @@ chat_log_omemo_msg_in(ProfMessage *message)
_chat_log_chat(mybarejid, message->from_jid->barejid, "[redacted]", PROF_IN_LOG, message->timestamp, message->from_jid->resourcepart);
}
}
prefs_free_string(pref_omemo_log);
g_free(pref_omemo_log);
free(mybarejid);
}
}
@ -548,7 +548,7 @@ groupchat_log_omemo_msg_out(const gchar *const room, const gchar *const msg)
_groupchat_log_chat(mybarejid, room, mynick, "[redacted]");
}
prefs_free_string(pref_omemo_log);
g_free(pref_omemo_log);
free(mybarejid);
}
}
@ -566,7 +566,7 @@ groupchat_log_omemo_msg_in(const gchar *const room, const gchar *const nick, con
_groupchat_log_chat(mybarejid, room, nick, "[redacted]");
}
prefs_free_string(pref_omemo_log);
g_free(pref_omemo_log);
free(mybarejid);
}
}

View File

@ -1348,7 +1348,7 @@ omemo_automatic_start(const char *const recipient)
policy = PROF_OMEMOPOLICY_ALWAYS;
}
prefs_free_string(pref_omemo_policy);
g_free(pref_omemo_policy);
}
switch (policy) {

View File

@ -700,7 +700,7 @@ otr_get_policy(const char *const recipient)
result = PROF_OTRPOLICY_ALWAYS;
}
prefs_free_string(pref_otr_policy);
g_free(pref_otr_policy);
return result;
}

View File

@ -152,7 +152,7 @@ _connect_default(const char *const account)
char *pref_connect_account = prefs_get_string(PREF_CONNECT_ACCOUNT);
if (pref_connect_account) {
cmd_execute_connect(window, pref_connect_account);
prefs_free_string(pref_connect_account);
g_free(pref_connect_account);
}
}
}
@ -197,7 +197,7 @@ _init(char *log_level, char *config_file, char *log_file, char *theme_name)
} else {
char *theme = prefs_get_string(PREF_THEME);
theme_init(theme);
prefs_free_string(theme);
g_free(theme);
}
ui_init();

View File

@ -236,7 +236,7 @@ end:
free(output.buffer);
pthread_mutex_lock(&lock);
prefs_free_string(cert_path);
g_free(cert_path);
if (err) {
char *msg;

View File

@ -345,7 +345,7 @@ cons_show_incoming_room_message(const char *const nick, const char *const room,
cons_alert();
}
}
prefs_free_string(muc_show);
g_free(muc_show);
}
void
@ -367,7 +367,7 @@ cons_show_incoming_message(const char *const short_from, const int win_index, in
cons_alert();
}
prefs_free_string(chat_show);
g_free(chat_show);
}
void
@ -389,7 +389,7 @@ cons_show_incoming_private_message(const char *const nick, const char *const roo
cons_alert();
}
prefs_free_string(priv_show);
g_free(priv_show);
}
void
@ -1092,7 +1092,7 @@ cons_theme_setting(void)
} else {
cons_show("Theme (/theme) : %s", theme);
}
prefs_free_string(theme);
g_free(theme);
}
void
@ -1182,15 +1182,15 @@ cons_console_setting(void)
{
char *chatsetting = prefs_get_string(PREF_CONSOLE_CHAT);
cons_show("Console chat messages (/console) : %s", chatsetting);
prefs_free_string(chatsetting);
g_free(chatsetting);
char *mucsetting = prefs_get_string(PREF_CONSOLE_MUC);
cons_show("Console MUC messages (/console) : %s", mucsetting);
prefs_free_string(mucsetting);
g_free(mucsetting);
char *privsetting = prefs_get_string(PREF_CONSOLE_PRIVATE);
cons_show("Console private messages (/console) : %s", privsetting);
prefs_free_string(privsetting);
g_free(privsetting);
}
void
@ -1209,9 +1209,9 @@ cons_presence_setting(void)
cons_show("Chat presence (/presence) : %s", chat);
cons_show("Room presence (/presence) : %s", room);
prefs_free_string(console);
prefs_free_string(chat);
prefs_free_string(room);
g_free(console);
g_free(chat);
g_free(room);
}
void
@ -1309,7 +1309,7 @@ cons_autoconnect_setting(void)
else
cons_show("Autoconnect (/autoconnect) : OFF");
prefs_free_string(pref_connect_account);
g_free(pref_connect_account);
}
void
@ -1320,53 +1320,53 @@ cons_time_setting(void)
cons_show("Time console (/time) : OFF");
else
cons_show("Time console (/time) : %s", pref_time_console);
prefs_free_string(pref_time_console);
g_free(pref_time_console);
char *pref_time_chat = prefs_get_string(PREF_TIME_CHAT);
if (g_strcmp0(pref_time_chat, "off") == 0)
cons_show("Time chat (/time) : OFF");
else
cons_show("Time chat (/time) : %s", pref_time_chat);
prefs_free_string(pref_time_chat);
g_free(pref_time_chat);
char *pref_time_muc = prefs_get_string(PREF_TIME_MUC);
if (g_strcmp0(pref_time_muc, "off") == 0)
cons_show("Time MUC (/time) : OFF");
else
cons_show("Time MUC (/time) : %s", pref_time_muc);
prefs_free_string(pref_time_muc);
g_free(pref_time_muc);
char *pref_time_conf = prefs_get_string(PREF_TIME_CONFIG);
if (g_strcmp0(pref_time_conf, "off") == 0)
cons_show("Time config (/time) : OFF");
else
cons_show("Time config (/time) : %s", pref_time_conf);
prefs_free_string(pref_time_conf);
g_free(pref_time_conf);
char *pref_time_private = prefs_get_string(PREF_TIME_PRIVATE);
if (g_strcmp0(pref_time_private, "off") == 0)
cons_show("Time private (/time) : OFF");
else
cons_show("Time private (/time) : %s", pref_time_private);
prefs_free_string(pref_time_private);
g_free(pref_time_private);
char *pref_time_xml = prefs_get_string(PREF_TIME_XMLCONSOLE);
if (g_strcmp0(pref_time_xml, "off") == 0)
cons_show("Time XML Console (/time) : OFF");
else
cons_show("Time XML Console (/time) : %s", pref_time_xml);
prefs_free_string(pref_time_xml);
g_free(pref_time_xml);
char *pref_time_statusbar = prefs_get_string(PREF_TIME_STATUSBAR);
if (g_strcmp0(pref_time_statusbar, "off") == 0)
cons_show("Time statusbar (/time) : OFF");
else
cons_show("Time statusbar (/time) : %s", pref_time_statusbar);
prefs_free_string(pref_time_statusbar);
g_free(pref_time_statusbar);
char *pref_time_lastactivity = prefs_get_string(PREF_TIME_LASTACTIVITY);
cons_show("Time last activity (/time) : %s", pref_time_lastactivity);
prefs_free_string(pref_time_lastactivity);
g_free(pref_time_lastactivity);
}
void
@ -1497,7 +1497,7 @@ cons_roster_setting(void)
} else {
cons_show("Roster count (/roster) : %s", count);
}
prefs_free_string(count);
g_free(count);
if (prefs_get_boolean(PREF_ROSTER_COUNT_ZERO))
cons_show("Roster count zero (/roster) : ON");
@ -1506,11 +1506,11 @@ cons_roster_setting(void)
char *by = prefs_get_string(PREF_ROSTER_BY);
cons_show("Roster by (/roster) : %s", by);
prefs_free_string(by);
g_free(by);
char *order = prefs_get_string(PREF_ROSTER_ORDER);
cons_show("Roster order (/roster) : %s", order);
prefs_free_string(order);
g_free(order);
char *unread = prefs_get_string(PREF_ROSTER_UNREAD);
if (g_strcmp0(unread, "before") == 0) {
@ -1520,7 +1520,7 @@ cons_roster_setting(void)
} else {
cons_show("Roster unread (/roster) : OFF");
}
prefs_free_string(unread);
g_free(unread);
if (prefs_get_boolean(PREF_ROSTER_ROOMS))
cons_show("Roster rooms (/roster) : show");
@ -1535,23 +1535,23 @@ cons_roster_setting(void)
} else {
cons_show("Roster private (/roster) : OFF");
}
prefs_free_string(priv);
g_free(priv);
char *rooms_pos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
cons_show("Roster rooms position (/roster) : %s", rooms_pos);
prefs_free_string(rooms_pos);
g_free(rooms_pos);
char *rooms_by = prefs_get_string(PREF_ROSTER_ROOMS_BY);
cons_show("Roster rooms by (/roster) : %s", rooms_by);
prefs_free_string(rooms_by);
g_free(rooms_by);
char *rooms_use = prefs_get_string(PREF_ROSTER_ROOMS_USE_AS_NAME);
cons_show("Roster rooms use (/roster) : %s", rooms_use);
prefs_free_string(rooms_use);
g_free(rooms_use);
char *rooms_order = prefs_get_string(PREF_ROSTER_ROOMS_ORDER);
cons_show("Roster rooms order (/roster) : %s", rooms_order);
prefs_free_string(rooms_order);
g_free(rooms_order);
char *roomsunread = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
if (g_strcmp0(roomsunread, "before") == 0) {
@ -1561,7 +1561,7 @@ cons_roster_setting(void)
} else {
cons_show("Roster rooms unread (/roster) : OFF");
}
prefs_free_string(roomsunread);
g_free(roomsunread);
int size = prefs_get_roster_size();
cons_show("Roster size (/roster) : %d", size);
@ -1833,15 +1833,15 @@ cons_statusbar_setting(void)
} else {
cons_show("Self statusbar display (/statusbar) : %s", pref_self);
}
prefs_free_string(pref_self);
g_free(pref_self);
char *pref_chat = prefs_get_string(PREF_STATUSBAR_CHAT);
cons_show("Chat tab display (/statusbar) : %s", pref_chat);
prefs_free_string(pref_chat);
g_free(pref_chat);
char *pref_room = prefs_get_string(PREF_STATUSBAR_ROOM);
cons_show("Room tab display (/statusbar) : %s", pref_room);
prefs_free_string(pref_room);
g_free(pref_room);
}
void
@ -1906,7 +1906,7 @@ cons_autoaway_setting(void)
} else {
cons_show("Autoaway (/autoaway mode) : %s", pref_autoaway_mode);
}
prefs_free_string(pref_autoaway_mode);
g_free(pref_autoaway_mode);
int away_time = prefs_get_autoaway_time();
if (away_time == 1) {
@ -1930,7 +1930,7 @@ cons_autoaway_setting(void)
} else {
cons_show("Autoaway away message (/autoaway message) : \"%s\"", pref_autoaway_message);
}
prefs_free_string(pref_autoaway_message);
g_free(pref_autoaway_message);
char *pref_autoxa_message = prefs_get_string(PREF_AUTOXA_MESSAGE);
if ((pref_autoxa_message == NULL) || (strcmp(pref_autoxa_message, "") == 0)) {
@ -1938,7 +1938,7 @@ cons_autoaway_setting(void)
} else {
cons_show("Autoaway xa message (/autoaway message) : \"%s\"", pref_autoxa_message);
}
prefs_free_string(pref_autoxa_message);
g_free(pref_autoxa_message);
if (prefs_get_boolean(PREF_AUTOAWAY_CHECK)) {
cons_show("Autoaway check (/autoaway check) : ON");
@ -2018,7 +2018,7 @@ cons_color_setting(void)
cons_show("Consistent color generation for nicks (/color) : OFF");
}
prefs_free_string(color_pref);
g_free(color_pref);
if (prefs_get_boolean(PREF_COLOR_NICK_OWN)) {
cons_show("Consistent color generation for own nick (/color own) : ON");
@ -2068,7 +2068,7 @@ cons_executable_setting(void)
{
char *avatar = prefs_get_string(PREF_AVATAR_CMD);
cons_show("Default '/avatar open' command (/executable avatar) : %s", avatar);
prefs_free_string(avatar);
g_free(avatar);
//TODO: there needs to be a way to get all the "locales"/schemes so we can
//display the defualt openers for all filetypes
@ -2112,7 +2112,7 @@ cons_show_otr_prefs(void)
char *policy_value = prefs_get_string(PREF_OTR_POLICY);
cons_show("OTR policy (/otr policy) : %s", policy_value);
prefs_free_string(policy_value);
g_free(policy_value);
char *log_value = prefs_get_string(PREF_OTR_LOG);
if (strcmp(log_value, "on") == 0) {
@ -2122,7 +2122,7 @@ cons_show_otr_prefs(void)
} else {
cons_show("OTR logging (/otr log) : Redacted");
}
prefs_free_string(log_value);
g_free(log_value);
char *ch = prefs_get_otr_char();
cons_show("OTR char (/otr char) : %s", ch);
@ -2151,7 +2151,7 @@ cons_show_pgp_prefs(void)
} else {
cons_show("PGP logging (/pgp log) : Redacted");
}
prefs_free_string(log_value);
g_free(log_value);
char *ch = prefs_get_pgp_char();
cons_show("PGP char (/pgp char) : %s", ch);
@ -2174,7 +2174,7 @@ cons_show_omemo_prefs(void)
char *policy_value = prefs_get_string(PREF_OMEMO_POLICY);
cons_show("OMEMO policy (/omemo policy) : %s", policy_value);
prefs_free_string(policy_value);
g_free(policy_value);
char *log_value = prefs_get_string(PREF_OMEMO_LOG);
if (strcmp(log_value, "on") == 0) {
@ -2184,7 +2184,7 @@ cons_show_omemo_prefs(void)
} else {
cons_show("OMEMO logging (/omemo log) : Redacted");
}
prefs_free_string(log_value);
g_free(log_value);
char *ch = prefs_get_omemo_char();
cons_show("OMEMO char (/omemo char) : %s", ch);

View File

@ -1070,8 +1070,8 @@ ui_contact_offline(char *barejid, char *resource, char *status)
FREE_SET_NULL(chatwin->resource_override);
}
prefs_free_string(show_console);
prefs_free_string(show_chat_win);
g_free(show_console);
g_free(show_chat_win);
jid_destroy(jid);
}

View File

@ -118,7 +118,7 @@ rosterwin_roster(void)
if (g_strcmp0(privpref, "group") == 0 || orphaned_privchats) {
_rosterwin_private_chats(layout, orphaned_privchats);
}
prefs_free_string(privpref);
g_free(privpref);
g_list_free(orphaned_privchats);
}
@ -148,7 +148,7 @@ rosterwin_roster(void)
if (prefs_get_boolean(PREF_ROSTER_UNSUBSCRIBED)) {
_rosteriwin_unsubscribed(layout);
}
prefs_free_string(by);
g_free(by);
}
if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "last") == 0)) {
@ -171,12 +171,12 @@ rosterwin_roster(void)
if (g_strcmp0(privpref, "group") == 0 || orphaned_privchats) {
_rosterwin_private_chats(layout, orphaned_privchats);
}
prefs_free_string(privpref);
g_free(privpref);
g_list_free(privchats);
g_list_free(orphaned_privchats);
}
prefs_free_string(roomspos);
g_free(roomspos);
}
static void
@ -190,7 +190,7 @@ _rosterwin_contacts_all(ProfLayoutSplit *layout)
} else {
contacts = roster_get_contacts(ROSTER_ORD_NAME);
}
prefs_free_string(order);
g_free(order);
GSList *filtered_contacts = _filter_contacts(contacts);
g_slist_free(contacts);
@ -260,7 +260,7 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
} else {
contacts = roster_get_group(group, ROSTER_ORD_NAME);
}
prefs_free_string(order);
g_free(order);
GSList *filtered_contacts = _filter_contacts(contacts);
g_slist_free(contacts);
@ -324,7 +324,7 @@ _rosterwin_unsubscribed_item(ProfLayoutSplit *layout, ProfChatWin *chatwin)
if ((g_strcmp0(unreadpos, "after") == 0) && unread > 0) {
g_string_append_printf(msg, " (%d)", unread);
}
prefs_free_string(unreadpos);
g_free(unreadpos);
win_sub_newline_lazy(layout->subwin);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -391,7 +391,7 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
unread = 0;
}
}
prefs_free_string(unreadpos);
g_free(unreadpos);
win_sub_newline_lazy(layout->subwin);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -433,7 +433,7 @@ _rosterwin_presence(ProfLayoutSplit *layout, const char *presence, const char *s
char *by = prefs_get_string(PREF_ROSTER_BY);
gboolean by_presence = g_strcmp0(by, "presence") == 0;
prefs_free_string(by);
g_free(by);
int presence_indent = prefs_get_roster_presence_indent();
if (presence_indent > 0) {
@ -538,7 +538,7 @@ _rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_inde
if ((g_strcmp0(unreadpos, "after") == 0) && unread > 0) {
g_string_append_printf(msg, " (%d)", unread);
}
prefs_free_string(unreadpos);
g_free(unreadpos);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
win_sub_print(layout->subwin, msg->str, FALSE, wrap, 0);
@ -566,7 +566,7 @@ _rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_inde
g_string_free(unreadmsg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour));
}
prefs_free_string(unreadpos);
g_free(unreadpos);
int resource_indent = prefs_get_roster_resource_indent();
if (resource_indent > 0) {
@ -622,7 +622,7 @@ _rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_inde
g_string_free(unreadmsg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour));
}
prefs_free_string(unreadpos);
g_free(unreadpos);
_rosterwin_presence(layout, presence, status, current_indent);
} else {
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -639,7 +639,7 @@ _rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_inde
g_string_free(unreadmsg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour));
}
prefs_free_string(unreadpos);
g_free(unreadpos);
}
g_list_free(resources);
@ -660,7 +660,7 @@ _rosterwin_rooms(ProfLayoutSplit *layout, char *title, GList *rooms)
} else {
rooms_sorted = g_list_insert_sorted(rooms_sorted, mucwin, (GCompareFunc)_compare_rooms_name);
}
prefs_free_string(order);
g_free(order);
}
curr_room = g_list_next(curr_room);
}
@ -793,13 +793,13 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
}
}
prefs_free_string(use_as_name);
prefs_free_string(roombypref);
g_free(use_as_name);
g_free(roombypref);
if ((g_strcmp0(unreadpos, "after") == 0) && mucwin->unread > 0) {
g_string_append_printf(msg, " (%d)", mucwin->unread);
}
prefs_free_string(unreadpos);
g_free(unreadpos);
win_sub_newline_lazy(layout->subwin);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -861,7 +861,7 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
if ((g_strcmp0(unreadpos, "after") == 0) && privwin->unread > 0) {
g_string_append_printf(privmsg, " (%d)", privwin->unread);
}
prefs_free_string(unreadpos);
g_free(unreadpos);
const char *presence = "offline";
@ -888,7 +888,7 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
g_list_free(privs);
}
prefs_free_string(privpref);
g_free(privpref);
}
static void
@ -902,7 +902,7 @@ _rosterwin_print_rooms(ProfLayoutSplit *layout)
_rosterwin_rooms(layout, "Rooms", rooms);
g_list_free(rooms);
}
prefs_free_string(roomsbypref);
g_free(roomsbypref);
}
static void
@ -955,7 +955,7 @@ _rosterwin_private_chats(ProfLayoutSplit *layout, GList *orphaned_privchats)
if ((g_strcmp0(unreadpos, "after") == 0) && privwin->unread > 0) {
g_string_append_printf(privmsg, " (%d)", privwin->unread);
}
prefs_free_string(unreadpos);
g_free(unreadpos);
Jid *jidp = jid_create(privwin->fulljid);
Occupant *occupant = muc_roster_item(jidp->barejid, jidp->resourcepart);
@ -1051,7 +1051,7 @@ _rosterwin_unsubscribed_header(ProfLayoutSplit *layout, GList *wins)
g_string_append_printf(header, " (%d)", unreadcount);
}
}
prefs_free_string(countpref);
g_free(countpref);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -1101,7 +1101,7 @@ _rosterwin_contacts_header(ProfLayoutSplit *layout, const char *const title, GSL
g_string_append_printf(header, " (%d)", unreadcount);
}
}
prefs_free_string(countpref);
g_free(countpref);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -1150,7 +1150,7 @@ _rosterwin_rooms_header(ProfLayoutSplit *layout, GList *rooms, char *title)
}
g_list_free(privwins);
}
prefs_free_string(prefpriv);
g_free(prefpriv);
curr = g_list_next(curr);
}
@ -1161,7 +1161,7 @@ _rosterwin_rooms_header(ProfLayoutSplit *layout, GList *rooms, char *title)
g_string_append_printf(header, " (%d)", unread);
}
}
prefs_free_string(countpref);
g_free(countpref);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -1206,7 +1206,7 @@ _rosterwin_private_header(ProfLayoutSplit *layout, GList *privs)
g_string_append_printf(title_str, " (%d)", unreadcount);
}
}
prefs_free_string(countpref);
g_free(countpref);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);

View File

@ -210,7 +210,7 @@ _create_tab(const int win, win_type_t wintype, char *identifier, gboolean highli
} else {
tab->display_name = strdup(tab->identifier);
}
prefs_free_string(pref);
g_free(pref);
}
}
@ -430,7 +430,7 @@ _status_bar_draw_time(int pos)
{
char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
if (g_strcmp0(time_pref, "off") == 0) {
prefs_free_string(time_pref);
g_free(time_pref);
return pos;
}
@ -461,7 +461,7 @@ _status_bar_draw_time(int pos)
wattroff(statusbar_win, bracket_attrs);
pos += 2;
prefs_free_string(time_pref);
g_free(time_pref);
return pos;
}
@ -493,7 +493,7 @@ _status_bar_draw_maintext(int pos)
stop = true;
}
prefs_free_string(pref);
g_free(pref);
if (stop) {
return;
}
@ -594,7 +594,7 @@ _display_name(StatusBarTab *tab)
} else {
fullname = strdup(tab->identifier);
}
prefs_free_string(pref);
g_free(pref);
} else if (tab->window_type == WIN_CONFIG) {
char *pref = prefs_get_string(PREF_STATUSBAR_ROOM);
GString *display_str = g_string_new("");
@ -607,7 +607,7 @@ _display_name(StatusBarTab *tab)
g_string_append(display_str, tab->identifier);
}
prefs_free_string(pref);
g_free(pref);
g_string_append(display_str, " conf");
char *result = strdup(display_str->str);
g_string_free(display_str, TRUE);
@ -627,7 +627,7 @@ _display_name(StatusBarTab *tab)
} else {
fullname = strdup(tab->identifier);
}
prefs_free_string(pref);
g_free(pref);
} else {
fullname = strdup("window");
}

View File

@ -1067,7 +1067,7 @@ win_show_status_string(ProfWin *window, const char *const from,
gchar *date_fmt = NULL;
char *time_pref = prefs_get_string(PREF_TIME_LASTACTIVITY);
date_fmt = g_date_time_format(last_activity, time_pref);
prefs_free_string(time_pref);
g_free(time_pref);
assert(date_fmt != NULL);
win_append(window, presence_colour, ", last activity: %s", date_fmt);
@ -1516,7 +1516,7 @@ _win_print_internal(ProfWin *window, const char *show_char, int pad_indent, GDat
} else {
date_fmt = g_date_time_format(time, time_pref);
}
prefs_free_string(time_pref);
g_free(time_pref);
assert(date_fmt != NULL);
if(strlen(date_fmt) != 0){
@ -1547,7 +1547,7 @@ _win_print_internal(ProfWin *window, const char *show_char, int pad_indent, GDat
colour = theme_hash_attrs(from);
}
}
prefs_free_string(color_pref);
g_free(color_pref);
if (flags & NO_COLOUR_FROM) {
colour = 0;

View File

@ -424,7 +424,7 @@ session_check_autoaway(void)
} else {
cons_show("Idle for %d minutes, status set to away (priority %d).", away_time, pri);
}
prefs_free_string(message);
g_free(message);
title_bar_set_presence(CONTACT_AWAY);
}
@ -467,7 +467,7 @@ session_check_autoaway(void)
} else {
cons_show("Idle for %d minutes, status set to xa (priority %d).", xa_time, pri);
}
prefs_free_string(message);
g_free(message);
title_bar_set_presence(CONTACT_XA);
} else if (check && (idle_ms < away_time_ms)) {
@ -498,7 +498,7 @@ session_check_autoaway(void)
}
free(curr_status);
prefs_free_string(mode);
g_free(mode);
}
static void

View File

@ -59,7 +59,7 @@ void cmd_otr_log_on_enables_logging(void **state)
assert_true(result);
assert_string_equal("on", pref_otr_log);
prefs_free_string(pref_otr_log);
g_free(pref_otr_log);
}
void cmd_otr_log_on_shows_warning_when_chlog_disabled(void **state)
@ -88,7 +88,7 @@ void cmd_otr_log_off_disables_logging(void **state)
assert_true(result);
assert_string_equal("off", pref_otr_log);
prefs_free_string(pref_otr_log);
g_free(pref_otr_log);
}
void cmd_otr_redact_redacts_logging(void **state)
@ -104,7 +104,7 @@ void cmd_otr_redact_redacts_logging(void **state)
assert_true(result);
assert_string_equal("redact", pref_otr_log);
prefs_free_string(pref_otr_log);
g_free(pref_otr_log);
}
void cmd_otr_log_redact_shows_warning_when_chlog_disabled(void **state)

View File

@ -67,7 +67,7 @@ void cmd_presence_console_sets_all(void **state)
assert_non_null(setting);
assert_string_equal("all", setting);
assert_true(result);
prefs_free_string(setting);
g_free(setting);
}
void cmd_presence_console_sets_online(void **state)
@ -82,7 +82,7 @@ void cmd_presence_console_sets_online(void **state)
assert_non_null(setting);
assert_string_equal("online", setting);
assert_true(result);
prefs_free_string(setting);
g_free(setting);
}
void cmd_presence_console_sets_none(void **state)
@ -97,7 +97,7 @@ void cmd_presence_console_sets_none(void **state)
assert_non_null(setting);
assert_string_equal("none", setting);
assert_true(result);
prefs_free_string(setting);
g_free(setting);
}
void cmd_presence_chat_sets_all(void **state)
@ -112,7 +112,7 @@ void cmd_presence_chat_sets_all(void **state)
assert_non_null(setting);
assert_string_equal("all", setting);
assert_true(result);
prefs_free_string(setting);
g_free(setting);
}
void cmd_presence_chat_sets_online(void **state)
@ -127,7 +127,7 @@ void cmd_presence_chat_sets_online(void **state)
assert_non_null(setting);
assert_string_equal("online", setting);
assert_true(result);
prefs_free_string(setting);
g_free(setting);
}
void cmd_presence_chat_sets_none(void **state)
@ -142,7 +142,7 @@ void cmd_presence_chat_sets_none(void **state)
assert_non_null(setting);
assert_string_equal("none", setting);
assert_true(result);
prefs_free_string(setting);
g_free(setting);
}
void cmd_presence_room_sets_all(void **state)
@ -157,7 +157,7 @@ void cmd_presence_room_sets_all(void **state)
assert_non_null(setting);
assert_string_equal("all", setting);
assert_true(result);
prefs_free_string(setting);
g_free(setting);
}