Hal Murray hmurray at megapathdsl.net
Sun Nov 22 05:02:44 UTC 2015

esr at thyrsus.com said:
> Sadly, I don't know of any good tutorials on this.  It is a swamp full of
> razor blades for even very experienced C programmers.  If you have a
> particular exporession you want me to analyze I might be able to say
> something useful. 

The old code was:

        int chars;
        char req_buf[CTL_MAX_DATA_LEN];

                req = req_buf;
                req_end = req_buf + sizeof(req_buf);
#define REQ_ROOM        (req_end - req)

                        chars = strlen(buf);
                        if (REQ_ROOM - chars < 1)

The new code is:

        size_t chars;

                        if (REQ_ROOM <= chars)

The old if didn't work after chars changed to size_t.

These are my opinions.  I hate spam.

More information about the devel mailing list