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)
  • irc_commands.c

    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 ) 
    3838                   command last. (Possibly it won't send it at all if it turns
    3939                   out we don't require it, which will break this feature.)
    4040                   Try to identify using the given password. */
    41                 return root_command( irc, send_cmd );
     41                root_command( irc, send_cmd );
     42                return;
    4243        }
    4344        /* Handling in pre-logged-in state, first see if this server is
    4445           password-protected: */
  • lib/oauth.c

    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, 
    5959        else
    6060        {
    6161                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 : "" );
    6363        }
    6464       
    6565        /* Inner part: H(K XOR 0x36, text) */
  • lib/xmltree.c

    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 ) 
    214214                return;
    215215       
    216216        if( node == NULL )
    217                 return xt_cleanup( xt, xt->root, depth );
     217                xt_cleanup( xt, xt->root, depth );
     218                return;
    218219       
    219220        if( node->flags & XT_SEEN && node == xt->root )
    220221        {
  • protocols/jabber/jabber.c

    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 ) 
    366366                imcb_log( ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority );
    367367                if( bud->away_state )
    368368                        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)" );
    370370               
    371371                bud = bud->next;
    372372        }
    static void jabber_set_away( struct im_connection *ic, char *state_txt, char *me 
    381381        /* state_txt == NULL -> Not away.
    382382           Unknown state -> fall back to the first defined away state. */
    383383        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;
    385385       
    386386        g_free( jd->away_message );
    387387        jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL;
  • protocols/jabber/message.c

    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 ) 
    5858                            ( inv = xt_find_node( c->children, "invite" ) ) )
    5959                        {
    6060                                room = from;
    61                                 from = xt_find_attr( inv, "from" ) ? : from;
     61                                from = xt_find_attr( inv, "from" ) ? xt_find_attr( inv, "from" ) : from;
    6262
    6363                                g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room );
    6464                                if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 )
    xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) 
    7171                        if( bud )
    7272                        {
    7373                                bud->last_msg = time( NULL );
    74                                 from = bud->ext_jid ? : bud->bare_jid;
     74                                from = bud->ext_jid ? bud->ext_jid : bud->bare_jid;
    7575                        }
    7676                        else
    7777                                *s = 0; /* We need to generate a bare JID now. */
  • protocols/msn/msn.c

    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 ) 
    153153        struct msn_data *md = ic->proto_data;
    154154       
    155155        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 ) :
    157157                                 msn_away_state_list + 1;
    158158        else
    159159                md->away_state = msn_away_state_list;
  • protocols/nogaim.c

    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 
    578578                realname_ = g_strdup_printf( " (%s)", realname );
    579579       
    580580        s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.",
    581                              handle, realname_ ?: "" );
     581                             handle, realname_ ? realname_ : "" );
    582582       
    583583        g_free( realname_ );
    584584       
    static void imcb_ask_add_cb_yes( void *data ) 
    600600       
    601601        cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL );
    602602       
    603         return imcb_ask_add_cb_no( data );
     603        imcb_ask_add_cb_no( data );
     604        return;
    604605}
    605606
    606607void 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 
    971972                char *ts = NULL;
    972973                if( set_getbool( &ic->irc->set, "display_timestamps" ) )
    973974                        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 );
    975976                g_free( ts );
    976977        }
    977978        else
    int imc_away_send_update( struct im_connection *ic ) 
    13021303                return 0;
    13031304       
    13041305        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" );
    13061307        if( away && *away )
    13071308        {
    13081309                GList *m = ic->acc->prpl->away_states( ic );
    13091310                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;
    13111312        }
    13121313        else if( ic->acc->flags & ACC_FLAG_STATUS_MESSAGE )
    13131314        {
    13141315                away = NULL;
    1315                 msg = set_getstr( &ic->acc->set, "status" ) ?
     1316                msg = set_getstr( &ic->acc->set, "status" ) ? set_getstr( &ic->acc->set, "status" )
    13161317                    : set_getstr( &ic->irc->set, "status" );
    13171318        }
    13181319       
  • protocols/yahoo/libyahoo2.c

    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) 
    23662366                goto fail;
    23672367        }
    23682368       
    2369         return yahoo_https_auth_init(had);
     2369        yahoo_https_auth_init(had);
     2370        return;
    23702371       
    23712372fail:
    23722373        g_free(had->token);
    void yahoo_accept_buddy_ymsg13(int id,const char* me,const char* who){ 
    43694370        struct yahoo_packet* pkt=NULL;
    43704371        pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0);
    43714372
    4372         yahoo_packet_hash(pkt,1,me ?: yd->user);       
     4373        yahoo_packet_hash(pkt,1,me ? me : yd->user);   
    43734374        yahoo_packet_hash(pkt,5,who);
    43744375        yahoo_packet_hash(pkt,13,"1");
    43754376        yahoo_packet_hash(pkt,334,"0");
    void yahoo_reject_buddy_ymsg13(int id,const char* me,const char* who,const char* 
    43884389        struct yahoo_packet* pkt=NULL;
    43894390        pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0);
    43904391
    4391         yahoo_packet_hash(pkt,1,me ?: yd->user);       
     4392        yahoo_packet_hash(pkt,1,me ? me : yd->user);   
    43924393        yahoo_packet_hash(pkt,5,who);
    43934394//      yahoo_packet_hash(pkt,241,YAHOO_PROTO_VER);
    43944395        yahoo_packet_hash(pkt,13,"2");
    43954396        yahoo_packet_hash(pkt,334,"0");
    43964397        yahoo_packet_hash(pkt,97,"1");
    4397         yahoo_packet_hash(pkt,14,msg?:"");
     4398        yahoo_packet_hash(pkt,14,msg? msg :"");
    43984399
    43994400        yahoo_send_packet(yid, pkt, 0);
    44004401        yahoo_packet_free(pkt);