link-grammar-5.8.0/link-grammar/dict-file/read-dialect.c
/**
 * Build the section array (index by section number).
 * Element 0 is reserved for a default entry table index, and is set later
 * (if a default section exists). The rest of the elements contain the
 * dialect table index of their section.
 */
Build the section array (index by section number).
Element 0 is reserved for a default entry table index, and is set later
(if a default section exists). The rest of the elements contain the
dialect table index of their section.
Build the section array ( index by section number ) . Element 0 is reserved for a default entry table index and is set later ( if a default section exists ) . The rest of the elements contain the dialect table index of their section .
static void section_add(Dialect *di, const char *token, unsigned int *size,
                        unsigned int table_index, unsigned int section_num)
{
	di->num_sections++;
	if (di->num_sections > *size)
	{
		if (di->num_sections == 1)
			*size = SECTIONS_INIT_SZ;
		else
			*size *= 2;
		di->section = realloc(di->section, *size * sizeof(*di->section));
	}
	di->section[di->num_sections] =
		(dialect_section_tag){ .name = token, .index = table_index };
	assert(di->num_sections == section_num);
}
static void section_add ( Dialect * di , const char * token , unsigned int * size , unsigned int table_index , unsigned int section_num ) { di -> num_sections ++ ; if ( di -> num_sections > * size ) { if ( di -> num_sections == 1 ) * size = SECTIONS_INIT_SZ ; else * size *= 2 ; di -> section = realloc ( di -> section , * size * sizeof ( * di -> section ) ) ; } di -> section [ di -> num_sections ] = ( dialect_section_tag ) { . name = token , . index = table_index } ; assert ( di -> num_sections == section_num ) ; }
Build the section array (index by section number).
Build the section array ( index by section number ) .