summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-10 08:36:30 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-10 08:36:30 +0800
commit3b109adbea257408835589c45e0125f77064274c (patch)
treeb2a9673dbcc896a9a7dc0bc3fa9d2cd234e6b792
parent482111964ded7556166917cdb0435bcc41796d4a (diff)
downloadpttbbs-3b109adbea257408835589c45e0125f77064274c.tar
pttbbs-3b109adbea257408835589c45e0125f77064274c.tar.gz
pttbbs-3b109adbea257408835589c45e0125f77064274c.tar.bz2
pttbbs-3b109adbea257408835589c45e0125f77064274c.tar.lz
pttbbs-3b109adbea257408835589c45e0125f77064274c.tar.xz
pttbbs-3b109adbea257408835589c45e0125f77064274c.tar.zst
pttbbs-3b109adbea257408835589c45e0125f77064274c.zip
return local variable
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2054 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/vote.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 25341f00..2af7495f 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -23,7 +23,7 @@ static char STR_new_title[] = "vtitle0\0";
#if 1 // backward compatible
-static void
+static FILE *
convert_to_newversion(FILE *fp, char *file, char *ballots)
{
char buf[256], buf2[256];
@@ -77,6 +77,8 @@ convert_to_newversion(FILE *fp, char *file, char *ballots)
unlink(file);
Rename(buf2, file);
fp = fopen(file, "r");
+ assert(fp != NULL);
+ return fp;
}
#endif
@@ -231,7 +233,7 @@ b_result_one(boardheader_t * fh, int ind, int *total)
cfp = fopen(buf, "r");
#if 1 // backward compatible
setbfile(b_control, bname, STR_new_ballots);
- convert_to_newversion(cfp, buf, b_control);
+ fp = convert_to_newversion(cfp, buf, b_control);
#endif
fscanf(cfp, "%hd,%hd\n%lu\n", &item_num, &junk, &closetime);
fclose(cfp);
@@ -444,7 +446,7 @@ vote_view(char *bname, int vote_index)
fp = fopen(buf, "r");
#if 1 // backward compatible
setbfile(genbuf, bname, STR_new_ballots);
- convert_to_newversion(fp, buf, genbuf);
+ fp = convert_to_newversion(fp, buf, genbuf);
#endif
fscanf(fp, "%hd,%hd\n%lu\n", &item_num, &i, &closetime);
counts = (int *)malloc(item_num * sizeof(int));
@@ -896,7 +898,7 @@ user_vote_one(char *bname, int ind)
#if 1 // backward compatible
setbfile(buf, bname, STR_new_control);
setbfile(inbuf, bname, STR_new_ballots);
- convert_to_newversion(cfp, buf, inbuf);
+ fp = convert_to_newversion(cfp, buf, inbuf);
#endif
fscanf(cfp, "%hd,%hd\n%lu\n", &item_num, &tickets, &closetime);
chosen = (char *)malloc(item_num);