close
Warning:
Failed to sync with repository "(default)": [Errno 12] Cannot allocate memory; repository information may be out of date. Look in the Trac log for more information including mitigation strategies.
Ticket #667: 0005-Do-not-return-values-in-void-functions-and-make-seco.patch
File 0005-Do-not-return-values-in-void-functions-and-make-seco.patch, 8.0 KB (added by Dagobert Michelsen <dam@…>, at 2010-08-06T15:45:45Z) |
|
-
From 858b58c86e8a1150d7ca3ab3f8ae5c8b83ad5f36 Mon Sep 17 00:00:00 2001
From: Dagobert Michelsen <dam@opencsw.org>
Date: Fri, 6 Aug 2010 15:37:29 +0200
Subject: [PATCH 5/6] Do not return values in void functions and make second argument in ternary explicit
---
irc_commands.c | 3 ++-
lib/oauth.c | 2 +-
lib/xmltree.c | 3 ++-
protocols/jabber/jabber.c | 4 ++--
protocols/jabber/message.c | 4 ++--
protocols/msn/msn.c | 2 +-
protocols/nogaim.c | 13 +++++++------
protocols/yahoo/libyahoo2.c | 9 +++++----
8 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/irc_commands.c b/irc_commands.c
index 7a286ce..e1a2201 100644
a
|
b
|
static void irc_cmd_pass( irc_t *irc, char **cmd ) |
38 | 38 | command last. (Possibly it won't send it at all if it turns |
39 | 39 | out we don't require it, which will break this feature.) |
40 | 40 | Try to identify using the given password. */ |
41 | | return root_command( irc, send_cmd ); |
| 41 | root_command( irc, send_cmd ); |
| 42 | return; |
42 | 43 | } |
43 | 44 | /* Handling in pre-logged-in state, first see if this server is |
44 | 45 | password-protected: */ |
-
diff --git a/lib/oauth.c b/lib/oauth.c
index c60a5a5..57dd10f 100644
a
|
b
|
static char *oauth_sign( const char *method, const char *url, |
59 | 59 | else |
60 | 60 | { |
61 | 61 | g_snprintf( (gchar*) key, HMAC_BLOCK_SIZE + 1, "%s&%s", |
62 | | oi->sp->consumer_secret, oi->token_secret ? : "" ); |
| 62 | oi->sp->consumer_secret, oi->token_secret ? oi->token_secret : "" ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | /* Inner part: H(K XOR 0x36, text) */ |
-
diff --git a/lib/xmltree.c b/lib/xmltree.c
index 31f8ee9..3da6e42 100644
a
|
b
|
void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ) |
214 | 214 | return; |
215 | 215 | |
216 | 216 | if( node == NULL ) |
217 | | return xt_cleanup( xt, xt->root, depth ); |
| 217 | xt_cleanup( xt, xt->root, depth ); |
| 218 | return; |
218 | 219 | |
219 | 220 | if( node->flags & XT_SEEN && node == xt->root ) |
220 | 221 | { |
-
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index 75351d0..c24d231 100644
a
|
b
|
static void jabber_get_info( struct im_connection *ic, char *who ) |
366 | 366 | imcb_log( ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority ); |
367 | 367 | if( bud->away_state ) |
368 | 368 | imcb_log( ic, "Away state: %s", bud->away_state->full_name ); |
369 | | imcb_log( ic, "Status message: %s", bud->away_message ? : "(none)" ); |
| 369 | imcb_log( ic, "Status message: %s", bud->away_message ? bud->away_message : "(none)" ); |
370 | 370 | |
371 | 371 | bud = bud->next; |
372 | 372 | } |
… |
… |
static void jabber_set_away( struct im_connection *ic, char *state_txt, char *me |
381 | 381 | /* state_txt == NULL -> Not away. |
382 | 382 | Unknown state -> fall back to the first defined away state. */ |
383 | 383 | jd->away_state = state_txt ? jabber_away_state_by_name( state_txt ) |
384 | | ? : jabber_away_state_list : NULL; |
| 384 | ? jabber_away_state_by_name( state_txt ) : jabber_away_state_list : NULL; |
385 | 385 | |
386 | 386 | g_free( jd->away_message ); |
387 | 387 | jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL; |
-
diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c
index fa915bd..86dd6f5 100644
a
|
b
|
xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) |
58 | 58 | ( inv = xt_find_node( c->children, "invite" ) ) ) |
59 | 59 | { |
60 | 60 | room = from; |
61 | | from = xt_find_attr( inv, "from" ) ? : from; |
| 61 | from = xt_find_attr( inv, "from" ) ? xt_find_attr( inv, "from" ) : from; |
62 | 62 | |
63 | 63 | g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room ); |
64 | 64 | if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 ) |
… |
… |
xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) |
71 | 71 | if( bud ) |
72 | 72 | { |
73 | 73 | bud->last_msg = time( NULL ); |
74 | | from = bud->ext_jid ? : bud->bare_jid; |
| 74 | from = bud->ext_jid ? bud->ext_jid : bud->bare_jid; |
75 | 75 | } |
76 | 76 | else |
77 | 77 | *s = 0; /* We need to generate a bare JID now. */ |
-
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index 7dbdb9d..0e7e73c 100644
a
|
b
|
static void msn_set_away( struct im_connection *ic, char *state, char *message ) |
153 | 153 | struct msn_data *md = ic->proto_data; |
154 | 154 | |
155 | 155 | if( state ) |
156 | | md->away_state = msn_away_state_by_name( state ) ? : |
| 156 | md->away_state = msn_away_state_by_name( state ) ? msn_away_state_by_name( state ) : |
157 | 157 | msn_away_state_list + 1; |
158 | 158 | else |
159 | 159 | md->away_state = msn_away_state_list; |
-
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 2248d11..12940a3 100644
a
|
b
|
void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *re |
578 | 578 | realname_ = g_strdup_printf( " (%s)", realname ); |
579 | 579 | |
580 | 580 | s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.", |
581 | | handle, realname_ ?: "" ); |
| 581 | handle, realname_ ? realname_ : "" ); |
582 | 582 | |
583 | 583 | g_free( realname_ ); |
584 | 584 | |
… |
… |
static void imcb_ask_add_cb_yes( void *data ) |
600 | 600 | |
601 | 601 | cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL ); |
602 | 602 | |
603 | | return imcb_ask_add_cb_no( data ); |
| 603 | imcb_ask_add_cb_no( data ); |
| 604 | return; |
604 | 605 | } |
605 | 606 | |
606 | 607 | void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) |
… |
… |
void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t fl |
971 | 972 | char *ts = NULL; |
972 | 973 | if( set_getbool( &ic->irc->set, "display_timestamps" ) ) |
973 | 974 | ts = format_timestamp( ic->irc, sent_at ); |
974 | | irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, ts ? : "", wrapped ); |
| 975 | irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, ts ? ts : "", wrapped ); |
975 | 976 | g_free( ts ); |
976 | 977 | } |
977 | 978 | else |
… |
… |
int imc_away_send_update( struct im_connection *ic ) |
1302 | 1303 | return 0; |
1303 | 1304 | |
1304 | 1305 | away = set_getstr( &ic->acc->set, "away" ) ? |
1305 | | : set_getstr( &ic->irc->set, "away" ); |
| 1306 | set_getstr( &ic->acc->set, "away" ) : set_getstr( &ic->irc->set, "away" ); |
1306 | 1307 | if( away && *away ) |
1307 | 1308 | { |
1308 | 1309 | GList *m = ic->acc->prpl->away_states( ic ); |
1309 | 1310 | msg = ic->acc->flags & ACC_FLAG_AWAY_MESSAGE ? away : NULL; |
1310 | | away = imc_away_state_find( m, away, &msg ) ? : m->data; |
| 1311 | away = imc_away_state_find( m, away, &msg ) ? imc_away_state_find( m, away, &msg ) : m->data; |
1311 | 1312 | } |
1312 | 1313 | else if( ic->acc->flags & ACC_FLAG_STATUS_MESSAGE ) |
1313 | 1314 | { |
1314 | 1315 | away = NULL; |
1315 | | msg = set_getstr( &ic->acc->set, "status" ) ? |
| 1316 | msg = set_getstr( &ic->acc->set, "status" ) ? set_getstr( &ic->acc->set, "status" ) |
1316 | 1317 | : set_getstr( &ic->irc->set, "status" ); |
1317 | 1318 | } |
1318 | 1319 | |
-
diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c
index 1bfc2e5..eeab5a1 100644
a
|
b
|
static void yahoo_https_auth_token_finish(struct http_request *req) |
2366 | 2366 | goto fail; |
2367 | 2367 | } |
2368 | 2368 | |
2369 | | return yahoo_https_auth_init(had); |
| 2369 | yahoo_https_auth_init(had); |
| 2370 | return; |
2370 | 2371 | |
2371 | 2372 | fail: |
2372 | 2373 | g_free(had->token); |
… |
… |
void yahoo_accept_buddy_ymsg13(int id,const char* me,const char* who){ |
4369 | 4370 | struct yahoo_packet* pkt=NULL; |
4370 | 4371 | pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0); |
4371 | 4372 | |
4372 | | yahoo_packet_hash(pkt,1,me ?: yd->user); |
| 4373 | yahoo_packet_hash(pkt,1,me ? me : yd->user); |
4373 | 4374 | yahoo_packet_hash(pkt,5,who); |
4374 | 4375 | yahoo_packet_hash(pkt,13,"1"); |
4375 | 4376 | yahoo_packet_hash(pkt,334,"0"); |
… |
… |
void yahoo_reject_buddy_ymsg13(int id,const char* me,const char* who,const char* |
4388 | 4389 | struct yahoo_packet* pkt=NULL; |
4389 | 4390 | pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0); |
4390 | 4391 | |
4391 | | yahoo_packet_hash(pkt,1,me ?: yd->user); |
| 4392 | yahoo_packet_hash(pkt,1,me ? me : yd->user); |
4392 | 4393 | yahoo_packet_hash(pkt,5,who); |
4393 | 4394 | // yahoo_packet_hash(pkt,241,YAHOO_PROTO_VER); |
4394 | 4395 | yahoo_packet_hash(pkt,13,"2"); |
4395 | 4396 | yahoo_packet_hash(pkt,334,"0"); |
4396 | 4397 | yahoo_packet_hash(pkt,97,"1"); |
4397 | | yahoo_packet_hash(pkt,14,msg?:""); |
| 4398 | yahoo_packet_hash(pkt,14,msg? msg :""); |
4398 | 4399 | |
4399 | 4400 | yahoo_send_packet(yid, pkt, 0); |
4400 | 4401 | yahoo_packet_free(pkt); |
Download in other formats: