third_party/inchi/INCHI_BASE/src/ichi_io.c
int inchi_strbuf_init( INCHI_IOS_STRING *buf, int start_size, int incr_size )
{
    char *new_str = NULL;
    memset( buf, 0, sizeof( *buf ) );

    if (start_size <= 0)
    {
        start_size = INCHI_STRBUF_INITIAL_SIZE;
    }
    if (incr_size <= 0)
    {
        incr_size = INCHI_STRBUF_SIZE_INCREMENT;
    }

    new_str = (char *) inchi_calloc( start_size, sizeof( char ) );

    if (!new_str)
    {
        return -1;
    }

    buf->pStr = new_str;
    buf->nAllocatedLength = start_size;
    buf->nPtr = incr_size;

    return start_size;
}
/****************************************************************************
 Init expandable buffer of type INCHI_IOS_STRING
****************************************************************************/
Init expandable buffer of type INCHI_IOS_STRING
Init expandable buffer of type INCHI_IOS_STRING
int inchi_strbuf_init( INCHI_IOS_STRING *buf, int start_size, int incr_size )
{
    char *new_str = NULL;
    memset( buf, 0, sizeof( *buf ) );
    if (start_size <= 0)
    {
        start_size = INCHI_STRBUF_INITIAL_SIZE;
    }
    if (incr_size <= 0)
    {
        incr_size = INCHI_STRBUF_SIZE_INCREMENT;
    }
    new_str = (char *) inchi_calloc( start_size, sizeof( char ) );
    if (!new_str)
    {
        return -1;
    }
    buf->pStr = new_str;
    buf->nAllocatedLength = start_size;
    buf->nPtr = incr_size;
    return start_size;
}
int inchi_strbuf_init ( INCHI_IOS_STRING * buf , int start_size , int incr_size ) { char * new_str = NULL ; memset ( buf , 0 , sizeof ( * buf ) ) ; if ( start_size <= 0 ) { start_size = INCHI_STRBUF_INITIAL_SIZE ; } if ( incr_size <= 0 ) { incr_size = INCHI_STRBUF_SIZE_INCREMENT ; } new_str = ( char * ) inchi_calloc ( start_size , sizeof ( char ) ) ; if ( ! new_str ) { return -1 ; } buf -> pStr = new_str ; buf -> nAllocatedLength = start_size ; buf -> nPtr = incr_size ; return start_size ; }
Init expandable buffer of type INCHI_IOS_STRING
Init expandable buffer of type INCHI_IOS_STRING