From 5657aac33dda3ac33d707205791a2cb92ec7e7b4 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Thu, 27 Jul 2023 12:38:30 +0200 Subject: [PATCH] Fix some more `char*` -> `gchar*`. Signed-off-by: Steffen Jaeckel --- src/config/preferences.c | 78 ++++++++++++++-------------------------- src/config/preferences.h | 24 ++++++------- src/log.c | 2 +- src/log.h | 2 +- src/ui/buffer.h | 2 +- src/ui/chatwin.c | 2 +- src/ui/confwin.c | 2 +- src/ui/console.c | 20 +++++------ src/ui/mucwin.c | 2 +- src/ui/occupantswin.c | 8 ++--- src/ui/privwin.c | 2 +- src/ui/rosterwin.c | 20 +++++------ src/ui/titlebar.c | 2 +- src/ui/ui.h | 18 +++++----- src/ui/vcardwin.c | 2 +- src/ui/window.c | 22 ++++++------ src/ui/window_list.c | 4 +-- src/ui/xmlwin.c | 4 +-- 18 files changed, 96 insertions(+), 120 deletions(-) diff --git a/src/config/preferences.c b/src/config/preferences.c index fe88b54c..64b8bed8 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -900,11 +900,11 @@ prefs_get_occupants_size(void) } } -char* +gchar* prefs_get_occupants_char(void) { - char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL); + gchar* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL); return result; } @@ -946,10 +946,10 @@ prefs_set_occupants_indent(gint value) g_key_file_set_integer(prefs, PREF_GROUP_UI, "occupants.indent", value); } -char* +gchar* prefs_get_occupants_header_char(void) { - char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.header.char", NULL); + gchar* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.header.char", NULL); return result; } @@ -988,14 +988,14 @@ prefs_get_roster_size(void) } } -static char* +static gchar* _prefs_get_encryption_char(const char* const ch, const char* const pref_group, const char* const key) { - char* result = NULL; + gchar* result = NULL; - char* resultstr = g_key_file_get_string(prefs, pref_group, key, NULL); + gchar* resultstr = g_key_file_get_string(prefs, pref_group, key, NULL); if (!resultstr) { - result = strdup(ch); + result = g_strdup(ch); } else { result = resultstr; } @@ -1015,7 +1015,7 @@ _prefs_set_encryption_char(const char* const ch, const char* const pref_group, c return FALSE; } -char* +gchar* prefs_get_otr_char(void) { return _prefs_get_encryption_char("~", PREF_GROUP_OTR, "otr.char"); @@ -1027,7 +1027,7 @@ prefs_set_otr_char(char* ch) return _prefs_set_encryption_char(ch, PREF_GROUP_OTR, "otr.char"); } -char* +gchar* prefs_get_pgp_char(void) { return _prefs_get_encryption_char("~", PREF_GROUP_PGP, "pgp.char"); @@ -1039,7 +1039,7 @@ prefs_set_pgp_char(char* ch) return _prefs_set_encryption_char(ch, PREF_GROUP_PGP, "pgp.char"); } -char* +gchar* prefs_get_ox_char(void) { return _prefs_get_encryption_char("%", PREF_GROUP_OX, "ox.char"); @@ -1051,7 +1051,7 @@ prefs_set_ox_char(char* ch) return _prefs_set_encryption_char(ch, PREF_GROUP_OX, "ox.char"); } -char* +gchar* prefs_get_omemo_char(void) { return _prefs_get_encryption_char("~", PREF_GROUP_OMEMO, "omemo.char"); @@ -1063,17 +1063,10 @@ prefs_set_omemo_char(char* ch) return _prefs_set_encryption_char(ch, PREF_GROUP_OMEMO, "omemo.char"); } -char* +gchar* prefs_get_roster_header_char(void) { - char* result = NULL; - - char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.header.char", NULL); - if (resultstr) { - result = resultstr; - } - - return result; + return g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.header.char", NULL); } void @@ -1092,12 +1085,10 @@ prefs_clear_roster_header_char(void) g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.header.char", NULL); } -char* +gchar* prefs_get_roster_contact_char(void) { - char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.contact.char", NULL); - - return result; + return g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.contact.char", NULL); } void @@ -1116,12 +1107,10 @@ prefs_clear_roster_contact_char(void) g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.contact.char", NULL); } -char* +gchar* prefs_get_roster_resource_char(void) { - char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.resource.char", NULL); - - return result; + return g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.resource.char", NULL); } void @@ -1140,12 +1129,10 @@ prefs_clear_roster_resource_char(void) g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.resource.char", NULL); } -char* +gchar* prefs_get_roster_private_char(void) { - char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.private.char", NULL); - - return result; + return g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.private.char", NULL); } void @@ -1164,12 +1151,10 @@ prefs_clear_roster_private_char(void) g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.private.char", NULL); } -char* +gchar* prefs_get_roster_room_char(void) { - char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL); - - return result; + return g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL); } void @@ -1188,12 +1173,10 @@ prefs_clear_roster_room_char(void) g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL); } -char* +gchar* prefs_get_roster_room_private_char(void) { - char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", NULL); - - return result; + return g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", NULL); } void @@ -1275,19 +1258,12 @@ prefs_set_roster_presence_indent(gint value) g_key_file_set_integer(prefs, PREF_GROUP_UI, "roster.presence.indent", value); } -char* +gchar* prefs_get_correction_char(void) { - char* result = "+"; + gchar* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "correction.char", NULL); - char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "correction.char", NULL); - if (!resultstr) { - result = strdup("+"); - } else { - result = resultstr; - } - - return result; + return resultstr ? resultstr : g_strdup("+"); } void diff --git a/src/config/preferences.h b/src/config/preferences.h index bfa5b695..22d6184e 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -256,38 +256,38 @@ gchar** prefs_get_plugins(void); void prefs_add_plugin(const char* const name); void prefs_remove_plugin(const char* const name); -char* prefs_get_otr_char(void); +gchar* prefs_get_otr_char(void); gboolean prefs_set_otr_char(char* ch); -char* prefs_get_pgp_char(void); +gchar* prefs_get_pgp_char(void); gboolean prefs_set_pgp_char(char* ch); -char* prefs_get_omemo_char(void); +gchar* prefs_get_omemo_char(void); gboolean prefs_set_omemo_char(char* ch); // XEP-0373: OpenPGP for XMPP char* prefs_get_ox_char(void); gboolean prefs_set_ox_char(char* ch); -char* prefs_get_roster_header_char(void); +gchar* prefs_get_roster_header_char(void); void prefs_set_roster_header_char(char* ch); void prefs_clear_roster_header_char(void); -char* prefs_get_roster_contact_char(void); +gchar* prefs_get_roster_contact_char(void); void prefs_set_roster_contact_char(char* ch); void prefs_clear_roster_contact_char(void); -char* prefs_get_roster_resource_char(void); +gchar* prefs_get_roster_resource_char(void); void prefs_set_roster_resource_char(char* ch); void prefs_clear_roster_resource_char(void); -char* prefs_get_roster_private_char(void); +gchar* prefs_get_roster_private_char(void); void prefs_set_roster_private_char(char* ch); void prefs_clear_roster_private_char(void); -char* prefs_get_roster_room_char(void); +gchar* prefs_get_roster_room_char(void); void prefs_set_roster_room_char(char* ch); void prefs_clear_roster_room_char(void); -char* prefs_get_roster_room_private_char(void); +gchar* prefs_get_roster_room_private_char(void); void prefs_set_roster_room_private_char(char* ch); void prefs_clear_roster_room_private_char(void); -char* prefs_get_occupants_char(void); +gchar* prefs_get_occupants_char(void); void prefs_set_occupants_char(char* ch); void prefs_clear_occupants_char(void); -char* prefs_get_occupants_header_char(void); +gchar* prefs_get_occupants_header_char(void); void prefs_set_occupants_header_char(char* ch); void prefs_clear_occupants_header_char(void); @@ -300,7 +300,7 @@ void prefs_set_roster_presence_indent(gint value); gint prefs_get_occupants_indent(void); void prefs_set_occupants_indent(gint value); -char* prefs_get_correction_char(void); +gchar* prefs_get_correction_char(void); void prefs_set_correction_char(char ch); void prefs_add_login(const char* jid); diff --git a/src/log.c b/src/log.c index a7abdcd5..541e0288 100644 --- a/src/log.c +++ b/src/log.c @@ -184,7 +184,7 @@ log_init(log_level_t filter, char* log_file) g_chmod(mainlogfile, S_IRUSR | S_IWUSR); } -const char* +const gchar* get_log_file_location(void) { return mainlogfile; diff --git a/src/log.h b/src/log.h index 3bf092b3..671747ae 100644 --- a/src/log.h +++ b/src/log.h @@ -49,7 +49,7 @@ typedef enum { void log_init(log_level_t filter, char* log_file); log_level_t log_get_filter(void); void log_close(void); -const char* get_log_file_location(void); +const gchar* get_log_file_location(void); void log_debug(const char* const msg, ...); void log_info(const char* const msg, ...); void log_warning(const char* const msg, ...); diff --git a/src/ui/buffer.h b/src/ui/buffer.h index 9daf18bb..591c4881 100644 --- a/src/ui/buffer.h +++ b/src/ui/buffer.h @@ -50,7 +50,7 @@ typedef struct delivery_receipt_t typedef struct prof_buff_entry_t { // pointer because it could be a unicode symbol as well - char* show_char; + gchar* show_char; int pad_indent; GDateTime* time; int flags; diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index c1ecd705..8f37ce13 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -503,7 +503,7 @@ chatwin_contact_offline(ProfChatWin* chatwin, char* resource, char* status) win_show_status_string((ProfWin*)chatwin, display_str, "offline", status, NULL, "--", "offline"); } -char* +gchar* chatwin_get_string(ProfChatWin* chatwin) { assert(chatwin != NULL); diff --git a/src/ui/confwin.c b/src/ui/confwin.c index a49b7010..2a80c610 100644 --- a/src/ui/confwin.c +++ b/src/ui/confwin.c @@ -329,7 +329,7 @@ _confwin_form_field(ProfWin* window, char* tag, FormField* field) } } -char* +gchar* confwin_get_string(ProfConfWin* confwin) { assert(confwin != NULL); diff --git a/src/ui/console.c b/src/ui/console.c index 2aa97034..efdc77b7 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -2168,7 +2168,7 @@ cons_correction_setting(void) cons_show("Last Message Correction (XEP-0308) (/correction) : OFF"); } - auto_char char* cc = prefs_get_correction_char(); + auto_gchar gchar* cc = prefs_get_correction_char(); cons_show("LMC indication char (/correction char) : %s", cc); } @@ -2258,7 +2258,7 @@ cons_show_otr_prefs(void) cons_show("OTR logging (/otr log) : Redacted"); } - auto_char char* ch = prefs_get_otr_char(); + auto_gchar gchar* ch = prefs_get_otr_char(); cons_show("OTR char (/otr char) : %s", ch); if (prefs_get_boolean(PREF_OTR_SENDFILE)) { @@ -2285,7 +2285,7 @@ cons_show_pgp_prefs(void) cons_show("PGP logging (/pgp log) : Redacted"); } - auto_char char* ch = prefs_get_pgp_char(); + auto_gchar gchar* ch = prefs_get_pgp_char(); cons_show("PGP char (/pgp char) : %s", ch); if (prefs_get_boolean(PREF_PGP_SENDFILE)) { @@ -2315,7 +2315,7 @@ cons_show_omemo_prefs(void) cons_show("OMEMO logging (/omemo log) : Redacted"); } - auto_char char* ch = prefs_get_omemo_char(); + auto_gchar gchar* ch = prefs_get_omemo_char(); cons_show("OMEMO char (/omemo char) : %s", ch); cons_alert(NULL); @@ -2336,7 +2336,7 @@ cons_show_ox_prefs(void) cons_show("OX logging (/ox log) : Redacted"); } - auto_char char* ch = prefs_get_ox_char(); + auto_gchar gchar* ch = prefs_get_ox_char(); cons_show("OX char (/ox char) : %s", ch); cons_alert(NULL); @@ -2541,11 +2541,11 @@ cons_alert(ProfWin* alert_origin_window) if (current->type != WIN_CONSOLE) { status_bar_new(1, WIN_CONSOLE, "console"); - auto_char char* win_name; + auto_gchar gchar* win_name; if (alert_origin_window) { win_name = win_to_string(alert_origin_window); } else { - win_name = strdup("console"); + win_name = g_strdup("console"); } GList* item = g_list_find_custom(alert_list, win_name, (GCompareFunc)g_strcmp0); @@ -2555,12 +2555,12 @@ cons_alert(ProfWin* alert_origin_window) } } -char* +gchar* cons_get_string(ProfConsoleWin* conswin) { assert(conswin != NULL); - return strdup("Console"); + return g_strdup("Console"); } void @@ -2881,7 +2881,7 @@ cons_clear_alerts(void) void cons_remove_alert(ProfWin* window) { - auto_char char* win_name = win_to_string(window); + auto_gchar gchar* win_name = win_to_string(window); GList* item = g_list_find_custom(alert_list, win_name, (GCompareFunc)g_strcmp0); alert_list = g_list_remove_link(alert_list, item); g_list_free_full(item, g_free); diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 7b1ed94d..5f6d27ff 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -931,7 +931,7 @@ mucwin_hide_occupants(ProfMucWin* mucwin) } } -char* +gchar* mucwin_get_string(ProfMucWin* mucwin) { assert(mucwin != NULL); diff --git a/src/ui/occupantswin.c b/src/ui/occupantswin.c index 5646da83..4613d472 100644 --- a/src/ui/occupantswin.c +++ b/src/ui/occupantswin.c @@ -65,8 +65,8 @@ _occuptantswin_occupant(ProfLayoutSplit* layout, GList* item, gboolean showjid, GString* spaces = g_string_new(" "); - int indent = prefs_get_occupants_indent(); - int current_indent = 0; + gint indent = prefs_get_occupants_indent(); + gint current_indent = 0; if (indent > 0) { current_indent += indent; while (indent > 0) { @@ -77,7 +77,7 @@ _occuptantswin_occupant(ProfLayoutSplit* layout, GList* item, gboolean showjid, GString* msg = g_string_new(spaces->str); - auto_char char* ch = prefs_get_occupants_char(); + auto_gchar gchar* ch = prefs_get_occupants_char(); if (ch) { g_string_append_printf(msg, "%s", ch); } @@ -129,7 +129,7 @@ occupantswin_occupants(const char* const roomjid) GString* prefix = g_string_new(" "); - auto_char char* ch = prefs_get_occupants_header_char(); + auto_gchar gchar* ch = prefs_get_occupants_header_char(); if (ch) { g_string_append_printf(prefix, "%s", ch); } diff --git a/src/ui/privwin.c b/src/ui/privwin.c index f6eb7cb1..81aaaa09 100644 --- a/src/ui/privwin.c +++ b/src/ui/privwin.c @@ -263,7 +263,7 @@ privwin_room_banned(ProfPrivateWin* privwin, const char* const actor, const char g_string_free(message, TRUE); } -char* +gchar* privwin_get_string(ProfPrivateWin* privwin) { assert(privwin != NULL); diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index 8ed71be6..52b21623 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -307,7 +307,7 @@ _rosterwin_unsubscribed_item(ProfLayoutSplit* layout, ProfChatWin* chatwin) indent--; } } - auto_char char* ch = prefs_get_roster_contact_char(); + auto_gchar gchar* ch = prefs_get_roster_contact_char(); if (ch) { g_string_append_printf(msg, "%s", ch); } @@ -368,7 +368,7 @@ _rosterwin_contact(ProfLayoutSplit* layout, PContact contact) indent--; } } - auto_char char* ch = prefs_get_roster_contact_char(); + auto_gchar gchar* ch = prefs_get_roster_contact_char(); if (ch) { g_string_append_printf(msg, "%s", ch); } @@ -517,7 +517,7 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde wattron(layout->subwin, theme_attrs(resource_presence_colour)); GString* msg = g_string_new(""); - auto_char char* ch = prefs_get_roster_resource_char(); + auto_gchar gchar* ch = prefs_get_roster_resource_char(); if (ch) { g_string_append_printf(msg, "%s", ch); } else { @@ -735,7 +735,7 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin) indent--; } } - auto_char char* ch = prefs_get_roster_room_char(); + auto_gchar gchar* ch = prefs_get_roster_room_char(); if (ch) { g_string_append_printf(msg, "%s", ch); } @@ -828,7 +828,7 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin) g_string_append_printf(privmsg, "(%d) ", privwin->unread); } - auto_char char* ch2 = prefs_get_roster_room_private_char(); + auto_gchar gchar* ch2 = prefs_get_roster_room_private_char(); if (ch2) { g_string_append_printf(privmsg, "%s", ch2); } @@ -919,7 +919,7 @@ _rosterwin_private_chats(ProfLayoutSplit* layout, GList* orphaned_privchats) g_string_append_printf(privmsg, "(%d) ", privwin->unread); } - auto_char char* ch = prefs_get_roster_private_char(); + auto_gchar gchar* ch = prefs_get_roster_private_char(); if (ch) { g_string_append_printf(privmsg, "%s", ch); } @@ -998,7 +998,7 @@ _rosterwin_unsubscribed_header(ProfLayoutSplit* layout, GList* wins) win_sub_newline_lazy(layout->subwin); GString* header = g_string_new(" "); - auto_char char* ch = prefs_get_roster_header_char(); + auto_gchar gchar* ch = prefs_get_roster_header_char(); if (ch) { g_string_append_printf(header, "%s", ch); } @@ -1043,7 +1043,7 @@ _rosterwin_contacts_header(ProfLayoutSplit* layout, const char* const title, GSL win_sub_newline_lazy(layout->subwin); GString* header = g_string_new(" "); - auto_char char* ch = prefs_get_roster_header_char(); + auto_gchar gchar* ch = prefs_get_roster_header_char(); if (ch) { g_string_append_printf(header, "%s", ch); } @@ -1093,7 +1093,7 @@ _rosterwin_rooms_header(ProfLayoutSplit* layout, GList* rooms, char* title) { win_sub_newline_lazy(layout->subwin); GString* header = g_string_new(" "); - auto_char char* ch = prefs_get_roster_header_char(); + auto_gchar gchar* ch = prefs_get_roster_header_char(); if (ch) { g_string_append_printf(header, "%s", ch); } @@ -1154,7 +1154,7 @@ _rosterwin_private_header(ProfLayoutSplit* layout, GList* privs) win_sub_newline_lazy(layout->subwin); GString* title_str = g_string_new(" "); - auto_char char* ch = prefs_get_roster_header_char(); + auto_gchar gchar* ch = prefs_get_roster_header_char(); if (ch) { g_string_append_printf(title_str, "%s", ch); } diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index ad5986de..a8dfa122 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -195,7 +195,7 @@ _title_bar_draw(void) waddch(win, ' '); } - auto_char char* title = win_get_title(current); + auto_gchar gchar* title = win_get_title(current); mvwprintw(win, 0, 0, " %s", title); pos = strlen(title) + 1; diff --git a/src/ui/ui.h b/src/ui/ui.h index 9255af3c..2c4d4c99 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -131,7 +131,7 @@ void chatwin_outgoing_msg(ProfChatWin* chatwin, const char* const message, char* void chatwin_outgoing_carbon(ProfChatWin* chatwin, ProfMessage* message); void chatwin_contact_online(ProfChatWin* chatwin, Resource* resource, GDateTime* last_activity); void chatwin_contact_offline(ProfChatWin* chatwin, char* resource, char* status); -char* chatwin_get_string(ProfChatWin* chatwin); +gchar* chatwin_get_string(ProfChatWin* chatwin); #ifdef HAVE_LIBOTR void chatwin_otr_secured(ProfChatWin* chatwin, gboolean trusted); void chatwin_otr_unsecured(ProfChatWin* chatwin); @@ -194,7 +194,7 @@ void mucwin_role_set_error(ProfMucWin* mucwin, const char* const nick, const cha void mucwin_role_list_error(ProfMucWin* mucwin, const char* const role, const char* const error); void mucwin_handle_role_list(ProfMucWin* mucwin, const char* const role, GSList* nicks); void mucwin_kick_error(ProfMucWin* mucwin, const char* const nick, const char* const error); -char* mucwin_get_string(ProfMucWin* mucwin); +gchar* mucwin_get_string(ProfMucWin* mucwin); void mucwin_set_enctext(ProfMucWin* mucwin, const char* const enctext); void mucwin_unset_enctext(ProfMucWin* mucwin); void mucwin_set_message_char(ProfMucWin* mucwin, const char* const ch); @@ -207,7 +207,7 @@ void privwin_message_occupant_offline(ProfPrivateWin* privwin); void privwin_message_left_room(ProfPrivateWin* privwin); -char* privwin_get_string(ProfPrivateWin* privwin); +gchar* privwin_get_string(ProfPrivateWin* privwin); void privwin_occupant_offline(ProfPrivateWin* privwin); void privwin_occupant_kicked(ProfPrivateWin* privwin, const char* const actor, const char* const reason); void privwin_occupant_banned(ProfPrivateWin* privwin, const char* const actor, const char* const reason); @@ -225,15 +225,15 @@ void confwin_show_form(ProfConfWin* confwin); void confwin_show_form_field(ProfConfWin* confwin, DataForm* form, char* tag); void confwin_form_help(ProfConfWin* confwin); void confwin_field_help(ProfConfWin* confwin, char* tag); -char* confwin_get_string(ProfConfWin* confwin); +gchar* confwin_get_string(ProfConfWin* confwin); // xml console void xmlwin_show(ProfXMLWin* xmlwin, const char* const msg); -char* xmlwin_get_string(ProfXMLWin* xmlwin); +gchar* xmlwin_get_string(ProfXMLWin* xmlwin); // vCard window void vcardwin_show_vcard_config(ProfVcardWin* vcardwin); -char* vcardwin_get_string(ProfVcardWin* vcardwin); +gchar* vcardwin_get_string(ProfVcardWin* vcardwin); void vcardwin_update(void); // Input window @@ -267,7 +267,7 @@ void cons_show_roster(GSList* list); void cons_show_roster_group(const char* const group, GSList* list); void cons_show_wins(gboolean unread); void cons_show_wins_attention(); -char* cons_get_string(ProfConsoleWin* conswin); +gchar* cons_get_string(ProfConsoleWin* conswin); void cons_show_status(const char* const barejid); void cons_show_info(PContact pcontact); void cons_show_caps(const char* const fulljid, resource_presence_t presence); @@ -399,7 +399,7 @@ void win_appendln(ProfWin* window, theme_item_t theme_item, const char* const me void win_append_highlight(ProfWin* window, theme_item_t theme_item, const char* const message, ...); void win_appendln_highlight(ProfWin* window, theme_item_t theme_item, const char* const message, ...); -char* win_get_title(ProfWin* window); +gchar* win_get_title(ProfWin* window); void win_show_occupant(ProfWin* window, Occupant* occupant); void win_show_occupant_info(ProfWin* window, const char* const room, Occupant* occupant); void win_show_contact(ProfWin* window, PContact contact); @@ -408,7 +408,7 @@ void win_show_vcard(ProfWin* window, vCard* vcard); void win_clear(ProfWin* window); char* win_get_tab_identifier(ProfWin* window); -char* win_to_string(ProfWin* window); +gchar* win_to_string(ProfWin* window); void win_command_list_error(ProfWin* window, const char* const error); void win_command_exec_error(ProfWin* window, const char* const command, const char* const error, ...); void win_handle_command_list(ProfWin* window, GSList* cmds); diff --git a/src/ui/vcardwin.c b/src/ui/vcardwin.c index 2a2fdd78..0cef89fd 100644 --- a/src/ui/vcardwin.c +++ b/src/ui/vcardwin.c @@ -49,7 +49,7 @@ vcardwin_show_vcard_config(ProfVcardWin* vcardwin) win_println(window, THEME_DEFAULT, "-", "Use '/help vcard' for more information."); } -char* +gchar* vcardwin_get_string(ProfVcardWin* vcardwin) { GString* string = g_string_new("vCard: "); diff --git a/src/ui/window.c b/src/ui/window.c index 53e03e0a..deb51bd9 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -296,17 +296,17 @@ win_create_vcard(vCard* vcard) return &new_win->window; } -char* +gchar* win_get_title(ProfWin* window) { if (window == NULL) { - return strdup(CONS_WIN_TITLE); + return g_strdup(CONS_WIN_TITLE); } switch (window->type) { case WIN_CONSOLE: { - return strdup(CONS_WIN_TITLE); + return g_strdup(CONS_WIN_TITLE); } case WIN_CHAT: { @@ -318,15 +318,15 @@ win_get_title(ProfWin* window) jabber_conn_status_t conn_status = connection_get_status(); if (conn_status != JABBER_CONNECTED || !show_titlebar_name) { - return strdup(chatwin->barejid); + return g_strdup(chatwin->barejid); } PContact contact = roster_get_contact(chatwin->barejid); if (!contact) { - return strdup(chatwin->barejid); + return g_strdup(chatwin->barejid); } const char* name = p_contact_name(contact); if (name == NULL) { - return strdup(chatwin->barejid); + return g_strdup(chatwin->barejid); } if (show_titlebar_jid) { return g_strdup_printf("%s <%s>", name, chatwin->barejid); @@ -369,17 +369,17 @@ win_get_title(ProfWin* window) { ProfPrivateWin* privatewin = (ProfPrivateWin*)window; assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK); - return strdup(privatewin->fulljid); + return g_strdup(privatewin->fulljid); } case WIN_XML: { - return strdup(XML_WIN_TITLE); + return g_strdup(XML_WIN_TITLE); } case WIN_PLUGIN: { ProfPluginWin* pluginwin = (ProfPluginWin*)window; assert(pluginwin->memcheck == PROFPLUGINWIN_MEMCHECK); - return strdup(pluginwin->tag); + return g_strdup(pluginwin->tag); } case WIN_VCARD: { @@ -478,7 +478,7 @@ win_get_last_sent_message(ProfWin* window) return last_message; } -char* +gchar* win_to_string(ProfWin* window) { assert(window != NULL); @@ -1372,7 +1372,7 @@ _win_correct(ProfWin* window, const char* const message, const char* const id, c entry->date = buffer_date_new_now(); */ - free(entry->show_char); + g_free(entry->show_char); entry->show_char = prefs_get_correction_char(); if (entry->message) { diff --git a/src/ui/window_list.c b/src/ui/window_list.c index 4898f7a5..a00fcb43 100644 --- a/src/ui/window_list.c +++ b/src/ui/window_list.c @@ -1134,7 +1134,7 @@ wins_create_summary(gboolean unread) GString* line = g_string_new(""); int ui_index = GPOINTER_TO_INT(curr->data); - auto_char char* winstring = win_to_string(window); + auto_gchar gchar* winstring = win_to_string(window); if (!winstring) { g_string_free(line, TRUE); continue; @@ -1179,7 +1179,7 @@ wins_create_summary_attention() GString* line = g_string_new(""); int ui_index = GPOINTER_TO_INT(curr->data); - auto_char char* winstring = win_to_string(window); + auto_gchar gchar* winstring = win_to_string(window); if (!winstring) { g_string_free(line, TRUE); continue; diff --git a/src/ui/xmlwin.c b/src/ui/xmlwin.c index fccbe27f..57dd6f4d 100644 --- a/src/ui/xmlwin.c +++ b/src/ui/xmlwin.c @@ -58,10 +58,10 @@ xmlwin_show(ProfXMLWin* xmlwin, const char* const msg) } } -char* +gchar* xmlwin_get_string(ProfXMLWin* xmlwin) { assert(xmlwin != NULL); - return strdup("XML console"); + return g_strdup("XML console"); }