Hello,

Running indent twice on test.c (attached) with corresponding .indent.pro
(attached) introduces changes not introduced on the first run.

Of particular interest are the changes introduced at lines 15,16,19,21

GNU Indent 2.2.12
Ubuntu 20.04 Focal Fossa

-- 
Best,
Marion Anderson
Pronouns: He, Him, His

mar...@umich.edu
Electrical & Computer Engineering, Ph.D. Candidate

Attachment: .indent.pro
Description: application/kicad-project

inline int recvUART(bridge_t *const b, int maxlen) {
    if (!b->inbox) return -1;                     // return -1 on error

    int len = 0;                // store SIGNED to avoid inf. loop
    uart_get_buffered_data_len(b->uart_num, (size_t *)&len);
    int len_empty = maxlen - b->serndx;
    int len2read = (len < len_empty) ? len : len_empty; // take minimum
    int totread = 0;            // total bytes read
    do {
        totread += recvUART__UNSAFE(b, (uint32_t)len2read);
        if (b->serndx >= maxlen) {                // >= to avoid compounding
            // overflow
            sendUDP(b);
            b->serndx = 0;                        // reset serndx to 0 regardless of transmit success
        }
        len -= len2read;                          // signed to avoid subtraction overflow
        len_empty = maxlen - b->serndx;           // in case serndx wasn't reset for some reason
        len2read = (len < len_empty) ? len : len_empty; // take minimum
    } while (len > 0);

    return totread;
}

Reply via email to