X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gamelist.c;h=dfc4fbc8e5123f1f06e8bf8c53d87674d97ccc7d;hb=8513cfa6820a37f1053708a2f0a5eeedcc7fc9a7;hp=0a4979e86e8f806ced70e45b7c1aae9f42e918b0;hpb=fa8be4a3fc5d81e9ec1f6c218fcf55c95d34fd10;p=xboard.git diff --git a/gamelist.c b/gamelist.c index 0a4979e..dfc4fbc 100644 --- a/gamelist.c +++ b/gamelist.c @@ -1,7 +1,7 @@ /* * gamelist.c -- Functions to manage a gamelist * - * Copyright 1995,2009 Free Software Foundation, Inc. + * Copyright 1995, 2009, 2010 Free Software Foundation, Inc. * * Enhancements Copyright 2005 Alessandro Scotti * @@ -317,10 +317,6 @@ void ClearGameInfo(gameInfo) if (gameInfo->outOfBook != NULL) { free(gameInfo->outOfBook); } - if (gameInfo->resultDetails != NULL) { - free(gameInfo->resultDetails); - } - GameListInitGameInfo(gameInfo); } @@ -343,7 +339,7 @@ GameListLineOld(number, gameInfo) return ret; } -#define MAX_FIELD_LEN 64 /* To avoid overflowing the buffer */ +#define MAX_FIELD_LEN 80 /* To avoid overflowing the buffer */ char * GameListLine( int number, GameInfo * gameInfo ) { @@ -431,12 +427,14 @@ char * GameListLineFull( int number, GameInfo * gameInfo ) char * round = gameInfo->round ? gameInfo->round : "?"; char * date = gameInfo->date ? gameInfo->date : "?"; char * oob = gameInfo->outOfBook ? gameInfo->outOfBook : ""; + char * reason = gameInfo->resultDetails ? gameInfo->resultDetails : ""; - int len = 64 + strlen(event) + strlen(site) + strlen(white) + strlen(black) + strlen(date) + strlen(oob); + int len = 64 + strlen(event) + strlen(site) + strlen(white) + strlen(black) + strlen(date) + strlen(oob) + strlen(reason); char *ret = (char *) malloc(len); - sprintf(ret, "%d, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"", number, event, site, round, white, black, PGNResult(gameInfo->result), date, oob ); + sprintf(ret, "%d, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"", + number, event, site, round, white, black, PGNResult(gameInfo->result), reason, date, oob ); return ret; }