about summary refs log tree commit diff stats
path: root/src/ui/mucwin.c
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2016-04-27 10:31:28 +0000
committerDmitry Podgorny <pasis.ua@gmail.com>2016-04-27 10:31:28 +0000
commitefbf233c8591c9310e326603b1c16368afd64564 (patch)
tree4f6e6a66bd1c7df7a2f0df7e04d842c5c462eaa1 /src/ui/mucwin.c
parent5687c3e419e88687a97b5bfa728ffe92bf8d4e98 (diff)
downloadprofani-tty-efbf233c8591c9310e326603b1c16368afd64564.tar.gz
Define stanza's attributes as const char*
In most get-like funcitons libstrophe returns pointer to a string
that resides in an internal structure (e.g. xmpp_stanza_t). Hence,
Profanity must not change such strings. Define respective variables
as 'const char*' to reduce a chance of error and conform future
libstrophe's interface.

This patch mostly replaces 'char *' with 'const char*', but also
fixes two memory leaks after stanza_get_reason(). Add comment within
stanza_get_reason() to fix conflict with different allocator types.
Diffstat (limited to 'src/ui/mucwin.c')
-rw-r--r--src/ui/mucwin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c
index 8ef40f82..432a9661 100644
--- a/src/ui/mucwin.c
+++ b/src/ui/mucwin.c
@@ -607,7 +607,7 @@ mucwin_handle_affiliation_list(ProfMucWin *mucwin, const char *const affiliation
         win_vprint(window, '!', 0, NULL, 0, 0, "", "Affiliation: %s", affiliation);
         GSList *curr_jid = jids;
         while (curr_jid) {
-            char *jid = curr_jid->data;
+            const char *jid = curr_jid->data;
             win_vprint(window, '!', 0, NULL, 0, 0, "", "  %s", jid);
             curr_jid = g_slist_next(curr_jid);
         }
@@ -699,7 +699,7 @@ mucwin_handle_role_list(ProfMucWin *mucwin, const char *const role, GSList *nick
         win_vprint(window, '!', 0, NULL, 0, 0, "", "Role: %s", role);
         GSList *curr_nick = nicks;
         while (curr_nick) {
-            char *nick = curr_nick->data;
+            const char *nick = curr_nick->data;
             Occupant *occupant = muc_roster_item(mucwin->roomjid, nick);
             if (occupant) {
                 if (occupant->jid) {