apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject apr_pstrndup
Date Wed, 28 Nov 2001 05:13:44 GMT
does this:
    end = memchr(s, '\0', n);
    if (end != NULL)
        n = end - s;

is that just  to avoid allocating an extra byte if 's' already contains
'\0' at the end?  seem like it would be better to waste the extra byte
than to scan the whole string with memchr() or at least change that to:
    if (*(s + (n-1)) == '\0') {
        n--;
    }

?



Mime
View raw message