Bug 27317

Summary: Permit wocky_xmpp_stanza_build (..., ASSIGN_TO, NULL, ...)
Product: Wocky Reporter: Will Thompson <will>
Component: GeneralAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

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.