Ignore:
Timestamp:
2015-02-20T22:50:54Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
0b9daac, 3d45471, 7733b8c
Parents:
af359b4
git-author:
Indent <please@…> (19-02-15 05:47:20)
git-committer:
dequis <dx@…> (20-02-15 22:50:54)
Message:

Reindent everything to K&R style with tabs

Used uncrustify, with the configuration file in ./doc/uncrustify.cfg

Commit author set to "Indent <please@…>" so that it's easier to
skip while doing git blame.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/txqueue.c

    raf359b4 r5ebff60  
    3232        }
    3333
    34         if (!(fr = (aim_frame_t *)g_new0(aim_frame_t,1)))
     34        if (!(fr = (aim_frame_t *) g_new0(aim_frame_t, 1))) {
    3535                return NULL;
    36 
    37         fr->conn = conn;
     36        }
     37
     38        fr->conn = conn;
    3839
    3940        fr->hdrtype = framing;
     
    4344                fr->hdr.flap.type = chan;
    4445
    45         } else
     46        } else {
    4647                imcb_error(sess->aux_data, "unknown framing");
     48        }
    4749
    4850        if (datalen > 0) {
    4951                guint8 *data;
    5052
    51                 if (!(data = (unsigned char *)g_malloc(datalen))) {
     53                if (!(data = (unsigned char *) g_malloc(datalen))) {
    5254                        aim_frame_destroy(fr);
    5355                        return NULL;
     
    9092
    9193        /* see overhead note in aim_rxqueue counterpart */
    92         if (!sess->queue_outgoing)
     94        if (!sess->queue_outgoing) {
    9395                sess->queue_outgoing = fr;
    94         else {
     96        } else {
    9597                aim_frame_t *cur;
    9698
    97                 for (cur = sess->queue_outgoing; cur->next; cur = cur->next)
     99                for (cur = sess->queue_outgoing; cur->next; cur = cur->next) {
    98100                        ;
     101                }
    99102                cur->next = fr;
    100103        }
     
    111114 * Basically the same as its __queuebased couterpart, however
    112115 * instead of doing a list append, it just calls aim_tx_sendframe()
    113  * right here. 
    114  * 
     116 * right here.
     117 *
    115118 */
    116119static int aim_tx_enqueue__immediate(aim_session_t *sess, aim_frame_t *fr)
     
    123126        }
    124127
    125         if (fr->hdrtype == AIM_FRAMETYPE_FLAP)
     128        if (fr->hdrtype == AIM_FRAMETYPE_FLAP) {
    126129                fr->hdr.flap.seqnum = aim_get_next_txseqnum(fr->conn);
     130        }
    127131
    128132        fr->handled = 0; /* not sent yet */
     
    137141int aim_tx_setenqueue(aim_session_t *sess, int what, int (*func)(aim_session_t *, aim_frame_t *))
    138142{
    139        
    140         if (what == AIM_TX_QUEUED)
     143
     144        if (what == AIM_TX_QUEUED) {
    141145                sess->tx_enqueue = &aim_tx_enqueue__queuebased;
    142         else if (what == AIM_TX_IMMEDIATE)
     146        } else if (what == AIM_TX_IMMEDIATE) {
    143147                sess->tx_enqueue = &aim_tx_enqueue__immediate;
    144         else if (what == AIM_TX_USER) {
    145                 if (!func)
     148        } else if (what == AIM_TX_USER) {
     149                if (!func) {
    146150                        return -EINVAL;
     151                }
    147152                sess->tx_enqueue = func;
    148         } else
     153        } else {
    149154                return -EINVAL; /* unknown action */
    150155
     156        }
    151157        return 0;
    152158}
     
    154160int aim_tx_enqueue(aim_session_t *sess, aim_frame_t *fr)
    155161{
    156        
     162
    157163        /*
    158164         * If we want to send a connection thats inprogress, we have to force
     
    160166         * want.
    161167         */
    162         if (fr && fr->conn && 
    163                         (fr->conn->status & AIM_CONN_STATUS_INPROGRESS)) {
     168        if (fr && fr->conn &&
     169            (fr->conn->status & AIM_CONN_STATUS_INPROGRESS)) {
    164170                return aim_tx_enqueue__queuebased(sess, fr);
    165171        }
     
    168174}
    169175
    170 /* 
     176/*
    171177 *  aim_get_next_txseqnum()
    172178 *
     
    180186{
    181187        flap_seqnum_t ret;
    182        
     188
    183189        ret = ++conn->seqnum;
    184190
     
    193199                int ret;
    194200
    195                 ret = send(fd, ((unsigned char *)buf)+cur, left, 0);
    196                 if (ret == -1)
     201                ret = send(fd, ((unsigned char *) buf) + cur, left, 0);
     202                if (ret == -1) {
    197203                        return -1;
    198                 else if (ret == 0)
     204                } else if (ret == 0) {
    199205                        return cur;
     206                }
    200207
    201208                cur += ret;
     
    209216{
    210217        int wrote = 0;
    211         if (!bs || !conn || (count < 0))
     218
     219        if (!bs || !conn || (count < 0)) {
    212220                return -EINVAL;
    213 
    214         if (count > aim_bstream_empty(bs))
     221        }
     222
     223        if (count > aim_bstream_empty(bs)) {
    215224                count = aim_bstream_empty(bs); /* truncate to remaining space */
    216225
     226        }
    217227        if (count) {
    218228                if (count - wrote) {
    219229                        wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, count - wrote);
    220230                }
    221                
    222         }
    223        
     231
     232        }
     233
    224234        bs->offset += wrote;
    225235
    226         return wrote;   
     236        return wrote;
    227237}
    228238
     
    235245        payloadlen = aim_bstream_curpos(&fr->data);
    236246
    237         if (!(obs_raw = g_malloc(6 + payloadlen)))
     247        if (!(obs_raw = g_malloc(6 + payloadlen))) {
    238248                return -ENOMEM;
     249        }
    239250
    240251        aim_bstream_init(&obs, obs_raw, 6 + payloadlen);
     
    252263        obslen = aim_bstream_curpos(&obs);
    253264        aim_bstream_rewind(&obs);
    254         if (aim_bstream_send(&obs, fr->conn, obslen) != obslen)
     265        if (aim_bstream_send(&obs, fr->conn, obslen) != obslen) {
    255266                err = -errno;
    256        
     267        }
     268
    257269        g_free(obs_raw); /* XXX aim_bstream_free */
    258270
     
    265277int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *fr)
    266278{
    267         if (fr->hdrtype == AIM_FRAMETYPE_FLAP)
     279        if (fr->hdrtype == AIM_FRAMETYPE_FLAP) {
    268280                return sendframe_flap(sess, fr);
     281        }
    269282        return -1;
    270283}
     
    276289        for (cur = sess->queue_outgoing; cur; cur = cur->next) {
    277290
    278                 if (cur->handled)
    279                         continue; /* already been sent */
    280 
    281                 if (cur->conn && (cur->conn->status & AIM_CONN_STATUS_INPROGRESS))
     291                if (cur->handled) {
     292                        continue; /* already been sent */
     293
     294                }
     295                if (cur->conn && (cur->conn->status & AIM_CONN_STATUS_INPROGRESS)) {
    282296                        continue;
     297                }
    283298
    284299                /*
     
    287302                 */
    288303                if ((cur->conn->lastactivity + cur->conn->forcedlatency) >= time(NULL)) {
    289                         /* 
    290                          * XXX should be a break! we dont want to block the 
     304                        /*
     305                         * XXX should be a break! we dont want to block the
    291306                         * upper layers
    292307                         *
     
    309324/*
    310325 *  aim_tx_purgequeue()
    311  * 
    312  *  This is responsable for removing sent commands from the transmit 
     326 *
     327 *  This is responsable for removing sent commands from the transmit
    313328 *  queue. This is not a required operation, but it of course helps
    314  *  reduce memory footprint at run time! 
     329 *  reduce memory footprint at run time!
    315330 *
    316331 */
     
    326341                        aim_frame_destroy(cur);
    327342
    328                 } else
     343                } else {
    329344                        prev = &cur->next;
     345                }
    330346        }
    331347
     
    347363
    348364        for (cur = sess->queue_outgoing; cur; cur = cur->next) {
    349                 if (cur->conn == conn)
     365                if (cur->conn == conn) {
    350366                        cur->handled = 1;
     367                }
    351368        }
    352369
Note: See TracChangeset for help on using the changeset viewer.