OwnCode/HttpFetcher/http-fetcher-orig/HttpFetcher.cpp
/*
 * Determines if the given NULL-terminated buffer is large enough to
 *  concatenate the given number of characters.  If not, it attempts to
 *  grow the buffer to fit.
 * Returns:
 *  0 on success, or
 *  -1 on error (original buffer is unchanged).
 */
Determines if the given NULL-terminated buffer is large enough to
concatenate the given number of characters.  If not, it attempts to
grow the buffer to fit.
Returns:
0 on success, or
-1 on error (original buffer is unchanged).
Determines if the given NULL - terminated buffer is large enough to concatenate the given number of characters . If not it attempts to grow the buffer to fit . Returns : 0 on success or - 1 on error ( original buffer is unchanged ) .
int _checkBufSize(char **buf, int *bufsize, int more)
{
    char *tmp;
    int roomLeft = *bufsize - (strlen(*buf) + 1);
    if (roomLeft > more)
        return 0;
    tmp = (char *)realloc(*buf, *bufsize + more + 1);
    if (tmp == NULL)
        return -1;
    *buf = tmp;
    *bufsize += more + 1;
    return 0;
}
int _checkBufSize ( char * * buf , int * bufsize , int more ) { char * tmp ; int roomLeft = * bufsize - ( strlen ( * buf ) + 1 ) ; if ( roomLeft > more ) return 0 ; tmp = ( char * ) realloc ( * buf , * bufsize + more + 1 ) ; if ( tmp == NULL ) return -1 ; * buf = tmp ; * bufsize += more + 1 ; return 0 ; }
Determines if the given NULL-terminated buffer is large enough to
  concatenate the given number of characters.
Determines if the given NULL - terminated buffer is large enough to concatenate the given number of characters .