/*
* 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
*
if (gameInfo->outOfBook != NULL) {
free(gameInfo->outOfBook);
}
- if (gameInfo->resultDetails != NULL) {
- free(gameInfo->resultDetails);
- }
-
GameListInitGameInfo(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 )
{
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;
}