third_party/inchi/INCHI_BASE/src/strutil.c
int imat_new( int m, int n, int ***a )
{
    int i;   
    if (m == 0 || n == 0)
    {
        return 0;
    }
    if (*a)
    {
        imat_free(m, *a);
        *a = NULL;
    }
    *a = (int **) inchi_calloc( m, sizeof( int * ) );
    if (NULL == *a)
    {
        return 1;
    }
    for (i = 0; i < m; i++)
    {
        ( *a )[i] = (int *) inchi_calloc( n, sizeof( int ) );
        if (NULL == ( *a )[i])
        {
            return 1;
        }
    }
    return 0;
}
/****************************************************************************
 Allocate integer matrix [mxn]
****************************************************************************/
Allocate integer matrix [mxn]
Allocate integer matrix [ mxn ]
int imat_new( int m, int n, int ***a )
{
    int i;   
    if (m == 0 || n == 0)
    {
        return 0;
    }
    if (*a)
    {
        imat_free(m, *a);
        *a = NULL;
    }
    *a = (int **) inchi_calloc( m, sizeof( int * ) );
    if (NULL == *a)
    {
        return 1;
    }
    for (i = 0; i < m; i++)
    {
        ( *a )[i] = (int *) inchi_calloc( n, sizeof( int ) );
        if (NULL == ( *a )[i])
        {
            return 1;
        }
    }
    return 0;
}
int imat_new ( int m , int n , int * * * a ) { int i ; if ( m == 0 || n == 0 ) { return 0 ; } if ( * a ) { imat_free ( m , * a ) ; * a = NULL ; } * a = ( int * * ) inchi_calloc ( m , sizeof ( int * ) ) ; if ( NULL == * a ) { return 1 ; } for ( i = 0 ; i < m ; i ++ ) { ( * a ) [ i ] = ( int * ) inchi_calloc ( n , sizeof ( int ) ) ; if ( NULL == ( * a ) [ i ] ) { return 1 ; } } return 0 ; }
Allocate integer matrix [mxn]
Allocate integer matrix [ mxn ]