Ejemplo n.º 1
0
void
lists_free( lists *a )
{
	int i;
	for ( i=0; i<a->max; ++i )
		newstr_free( &(a->str[i]) );
	free( a->str );
	lists_init( a );
}
Ejemplo n.º 2
0
static void
uniqueify_citekeys( bibl *b )
{
	lists citekeys;
	lists_init( &citekeys );
	get_citekeys( b, &citekeys );
	dup_citekeys( b, &citekeys );
	lists_free( &citekeys );
}
Ejemplo n.º 3
0
void		env_init(t_env *env)
{
	g_env = env;
	bzero(env, sizeof(*env));
	env->curr_npc = 0;
	env->selectcase = -1;
	env->camtrans[0] = -0.5;
	env->camtrans[1] = -10.1;
	env->camtrans[2] = -30.0;
	names_init(env);
	npcs_init(env);
	lists_init(env);
	list_item_init(env);
	list_white_init();
	list_red_init();
	list_blue_init();
	list_green_init();
	list_yellow_init();
	list_pink_init();
	list_cyan_init();
	list_highlight_init();
	team_colors_init(g_env->teamcol);
}
Ejemplo n.º 4
0
int
lists_fill( lists *a, char *filename )
{
	newstr line;
	FILE *fp;
	char *p;
	char buf[512]="";
	int  bufpos = 0;

	fp = fopen( filename, "r" );
	if ( !fp ) return 0;

	lists_init( a );

	newstr_init( &line );
	while ( newstr_fget( fp, buf, sizeof(buf), &bufpos, &line ) ) {
		p = &(line.data[0]);
		if ( *p=='\0' ) continue;
		if ( !lists_add( a, line.data ) ) return 0;
	}
	newstr_free( &line );
	fclose( fp );
	return 1;
}