pidgin: 385542a8: I don't see any reason to copy then free...
Paul Aurich
paul at darkrain42.org
Mon Mar 7 21:12:18 EST 2011
And markdoliner at pidgin.im spoke on 03/06/2011 10:45 PM, saying:
> ----------------------------------------------------------------------
> Revision: 385542a8270ac30d2121b533494264a28cd04423
> URL: http://d.pidgin.im/viewmtn/revision/info/385542a8270ac30d2121b533494264a28cd04423
>
> Changelog:
>
> I don't see any reason to copy then free this variable. Also let's call
> it username to be consistent with the rest of our code
>
> Changes against parent 6118d1117f31a7fc8db4bd5431af400a7b46ff17
>
> patched libpurple/protocols/jabber/jabber.c
The string is mutated (to remove a trailing '/') via the strchr, and I
didn't think it was good form to mutate account->username like that.
It's an ugly hack because internal to the prpl, everything is pedantic
about JIDs, and "paul at darkrain42.org/" isn't a valid one (but some UIs
currently generate that due to the username split stuff.
~Paul
> ============================================================
> --- libpurple/protocols/jabber/jabber.c ad50987594a75a4e32625b8192cb0ab9412e310a
> +++ libpurple/protocols/jabber/jabber.c fa87ad671cebe79ae7b403e233e9cf75d9dc2530
> @@ -924,25 +924,24 @@ jabber_stream_new(PurpleAccount *account
> PurpleConnection *gc = purple_account_get_connection(account);
> JabberStream *js;
> PurplePresence *presence;
> - gchar *user;
> + const gchar *username;
> gchar *slash;
>
> js = gc->proto_data = g_new0(JabberStream, 1);
> js->gc = gc;
> js->fd = -1;
>
> - user = g_strdup(purple_account_get_username(account));
> + username = purple_account_get_username(account);
> /* jabber_id_new doesn't accept "user at domain/" as valid */
> - slash = strchr(user, '/');
> + slash = strchr(username, '/');
> if (slash && *(slash + 1) == '\0')
> *slash = '\0';
here
> - js->user = jabber_id_new(user);
> + js->user = jabber_id_new(username);
>
> if (!js->user) {
> purple_connection_error_reason(gc,
> PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
> _("Invalid XMPP ID"));
> - g_free(user);
> /* Destroying the connection will free the JabberStream */
> return NULL;
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://pidgin.im/pipermail/devel/attachments/20110307/bf597f3d/attachment.sig>
More information about the Devel
mailing list