link-grammar-5.8.0/link-grammar/dict-file/read-dialect.c
/**
  * Add an entry to the dialect table di->table.
  * @return Table index of the added entry.
  */
Add an entry to the dialect table di->table.
@return Table index of the added entry.
Add an entry to the dialect table di - > table . @return Table index of the added entry .
static unsigned int dialect_table_add(Dialect *di, const char *token,
                                      unsigned int *size, double cost)
{
	if (di->num_table_tags == *size)
	{
		if (di->num_table_tags == 0)
			*size = DIALECT_TABLE_INIT_SZ;
		else
			*size *= 2;
		di->table = realloc(di->table, *size * sizeof(*di->table));
	}
	di->table[di->num_table_tags] = (dialect_tag){ .name = token, .cost = cost };
	return di->num_table_tags++;
}
static unsigned int dialect_table_add ( Dialect * di , const char * token , unsigned int * size , double cost ) { if ( di -> num_table_tags == * size ) { if ( di -> num_table_tags == 0 ) * size = DIALECT_TABLE_INIT_SZ ; else * size *= 2 ; di -> table = realloc ( di -> table , * size * sizeof ( * di -> table ) ) ; } di -> table [ di -> num_table_tags ] = ( dialect_tag ) { . name = token , . cost = cost } ; return di -> num_table_tags ++ ; }
Add an entry to the dialect table di->table.
Add an entry to the dialect table di - > table .