[DMN-commit] dmn/src/Config default.c,1.5,1.6
Status: Beta
Brought to you by:
xoseotero
From: <xos...@us...> - 2003-08-30 04:27:25
|
Update of /cvsroot/dmn/dmn/src/Config In directory sc8-pr-cvs1:/tmp/cvs-serv7000/src/Config Modified Files: default.c Log Message: Changes to make default (Config module) to work Index: default.c =================================================================== RCS file: /cvsroot/dmn/dmn/src/Config/default.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- default.c 29 Aug 2003 05:19:28 -0000 1.5 +++ default.c 30 Aug 2003 04:27:21 -0000 1.6 @@ -137,13 +137,15 @@ List_first(&orig); while (!List_endoflist(orig)) { copy_team = (List_t *) xmalloc(sizeof (List_t)); + List_init(copy_team); team = List_read(orig); List_first(team); while (!List_endoflist(*team)) { copy_couple = (List_t *) xmalloc(sizeof (List_t)); + List_init(copy_couple); - couple = List_read(orig); + couple = List_read(*team); List_first(couple); while (!List_endoflist(*couple)) { player = List_read(*couple); @@ -239,20 +241,13 @@ fclose(file); - if (!Conf_get(&conf_file, "main", "config", &data->Config)) - data->Config = NULL; - if (!Conf_get(&conf_file, "main", "display", &data->Display)) - data->Display = NULL; - if (!Conf_get(&conf_file, "main", "sound", &data->Sound)) - data->Sound = NULL; - if (!Conf_get(&conf_file, "main", "tournament", &data->Tournament)) - data->Tournament = NULL; - if (!Conf_get(&conf_file, "main", "match", &data->Match)) - data->Match = NULL; - if (!Conf_get(&conf_file, "main", "game", &data->Game)) - data->Game = NULL; - if (!Conf_get(&conf_file, "main", "hand", &data->Hand)) - data->Hand = NULL; + Conf_get(&conf_file, "main", "config", &data->Config); + Conf_get(&conf_file, "main", "display", &data->Display); + Conf_get(&conf_file, "main", "sound", &data->Sound); + Conf_get(&conf_file, "main", "tournament", &data->Tournament); + Conf_get(&conf_file, "main", "match", &data->Match); + Conf_get(&conf_file, "main", "game", &data->Game); + Conf_get(&conf_file, "main", "hand", &data->Hand); /* The scorpions said: Tease me, please me */ for (i = 1; cont; i++) { @@ -265,6 +260,8 @@ for (k = 1; cont; k++) { player = (Config_player_t *) xmalloc(sizeof (Config_player_t)); + player->name = NULL; + player->module = NULL; team_couple_player(i, j, k, &str); @@ -284,21 +281,30 @@ if (cont) List_push(couple, player); + else { + xfree(player->name); + xfree(player->module); + xfree(player); + } } /* teamX.coupleX.player1 is not set, so, bye bye */ - if (!cont && k != 1) + if (!cont && k != 2) cont = 1; if (cont) List_push(team, couple); + else + List_end(couple); } /* teamX.couple1 is not set, so, bye bye */ - if (!cont && j != 1) + if (!cont && j != 2) cont = 1; if (cont) List_push(&data->teams, team); + else + List_end(team); } xfree(aux); @@ -413,6 +419,7 @@ { Config_t *config = this; + free_teams(&DATA(config)->teams); List_end(&DATA(config)->teams); xfree(DATA(config)->Config); xfree(DATA(config)->Display); @@ -421,7 +428,6 @@ xfree(DATA(config)->Match); xfree(DATA(config)->Game); xfree(DATA(config)->Hand); - free_teams(&DATA(config)->teams); xfree(DATA(config)); return 1; |