On Fri, Sep 19, 2014 at 03:00:01AM +0000, eocene wrote:
Having thought about it probably too much over the past however many days, I haven't thought of a good reason not to stick it all in an ifdef like
#if defined(__sgi) /* IRIX does not conform to C99; if the entire argument did not fit * into the buffer, n = buffer space used (minus 1 for terminator) */ if (n > -1 && n + 1 < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else { n_sz = ds->sz * 2; } #else if (n > -1 && n < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else if (n > -1) { /* glibc >= 2.1 */ n_sz = ds->len + n + 1; } else { /* old glibc */ n_sz = ds->sz * 2; } #endif
and be done with it.
Fair enough, and IMHO simpler than my proposal. +1 -- Cheers Jorge.-