1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

removed strdup from g_string_append

This commit is contained in:
Dmitry Podgorny 2013-08-25 14:52:25 +03:00
parent d6c90ac7ca
commit c7ec06ff65
3 changed files with 12 additions and 12 deletions

View File

@ -687,15 +687,15 @@ cons_show_disco_info(const char *jid, GSList *identities, GSList *features)
DiscoIdentity *identity = identities->data; // anme trpe, cat
GString *identity_str = g_string_new(" ");
if (identity->name != NULL) {
identity_str = g_string_append(identity_str, strdup(identity->name));
identity_str = g_string_append(identity_str, identity->name);
identity_str = g_string_append(identity_str, " ");
}
if (identity->type != NULL) {
identity_str = g_string_append(identity_str, strdup(identity->type));
identity_str = g_string_append(identity_str, identity->type);
identity_str = g_string_append(identity_str, " ");
}
if (identity->category != NULL) {
identity_str = g_string_append(identity_str, strdup(identity->category));
identity_str = g_string_append(identity_str, identity->category);
}
cons_show(identity_str->str);
g_string_free(identity_str, FALSE);
@ -1347,7 +1347,7 @@ _show_roster_contacts(GSList *list, gboolean show_groups)
title = g_string_append(title, p_contact_barejid(contact));
if (p_contact_name(contact) != NULL) {
title = g_string_append(title, " (");
title = g_string_append(title, strdup(p_contact_name(contact)));
title = g_string_append(title, p_contact_name(contact));
title = g_string_append(title, ")");
}
@ -1394,7 +1394,7 @@ _show_roster_contacts(GSList *list, gboolean show_groups)
if (groups != NULL) {
GString *groups_str = g_string_new(" Groups : ");
while (groups != NULL) {
g_string_append(groups_str, strdup(groups->data));
g_string_append(groups_str, groups->data);
if (g_slist_next(groups) != NULL) {
g_string_append(groups_str, ", ");
}

View File

@ -492,15 +492,15 @@ ui_contact_online(const char * const barejid, const char * const resource,
// use nickname if exists
if (p_contact_name(contact) != NULL) {
g_string_append(display_str, strdup(p_contact_name(contact)));
g_string_append(display_str, p_contact_name(contact));
} else {
g_string_append(display_str, strdup(barejid));
g_string_append(display_str, barejid);
}
// add resource if not default provided by profanity
if (strcmp(jid->resourcepart, "__prof_default") != 0) {
g_string_append(display_str, " (");
g_string_append(display_str, strdup(jid->resourcepart));
g_string_append(display_str, jid->resourcepart);
g_string_append(display_str, ")");
}
@ -531,15 +531,15 @@ ui_contact_offline(const char * const from, const char * const show,
// use nickname if exists
if (p_contact_name(contact) != NULL) {
g_string_append(display_str, strdup(p_contact_name(contact)));
g_string_append(display_str, p_contact_name(contact));
} else {
g_string_append(display_str, strdup(jidp->barejid));
g_string_append(display_str, jidp->barejid);
}
// add resource if not default provided by profanity
if (strcmp(jidp->resourcepart, "__prof_default") != 0) {
g_string_append(display_str, " (");
g_string_append(display_str, strdup(jidp->resourcepart));
g_string_append(display_str, jidp->resourcepart);
g_string_append(display_str, ")");
}

View File

@ -567,7 +567,7 @@ _roster_handle_push(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
while (resources != NULL) {
GString *fulljid = g_string_new(strdup(barejid));
g_string_append(fulljid, "/");
g_string_append(fulljid, strdup(resources->data));
g_string_append(fulljid, resources->data);
autocomplete_remove(fulljid_ac, fulljid->str);
g_string_free(fulljid, TRUE);
resources = g_list_next(resources);