Bug 27317 - Permit wocky_xmpp_stanza_build (..., ASSIGN_TO, NULL, ...)
Summary: Permit wocky_xmpp_stanza_build (..., ASSIGN_TO, NULL, ...)
Status: RESOLVED INVALID
Alias: None
Product: Wocky
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-25 11:27 UTC by Will Thompson
Modified: 2010-04-20 08:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Will Thompson 2010-03-25 11:27:50 UTC
The pubsub code has a load of helper functions to build stanzas for various pubsub actions, where the caller can optionally pass addresses to store pointers to the <pubsub> node, the <create> node, etc. Currently they all look like this:

WockyXmppStanza *
wocky_pubsub_blah_create_foo_stanza (
   WockyPubsubBlah *self,
   WockyPubsubNode **pubsub_node,
   WockyPubsubNOde **foo_node)
{
  WockyPubsubStanza *stanza;
  WockyPubsubNode *pubsub, *foo;

  stanza = build (...,
      SHOUTY SHOUTY,
        SHOUTY_ASSIGN_TO, &pubsub, ..... );

  if (pubsub_node != NULL)
    *pubsub_node = pubsub;
}

It might be nice to let build accept NULL targets, and just not assign in that case. On the flipside, it arguably makes it harder to detect you screwing up.
Comment 1 Will Thompson 2010-04-20 08:27:41 UTC
Actually I just tried this, and it saved, erm, four lines of code. So I think I was wrong.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.