From 3f76b17cecfae6af61240a7ef9e5f21118e39f40 Mon Sep 17 00:00:00 2001 From: scw Date: Fri, 11 Feb 2005 16:59:42 +0000 Subject: Use chomp() instead of assigning '\0' directly. Change a little code in searching of more() to reduce call of strlen(). git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2495 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/vote.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mbbsd/vote.c') diff --git a/mbbsd/vote.c b/mbbsd/vote.c index eb5a576b..bc470232 100644 --- a/mbbsd/vote.c +++ b/mbbsd/vote.c @@ -304,7 +304,7 @@ b_result_one(vote_buffer_t *vbuf, boardheader_t * fh, int ind, int *total) fprintf(tfp, " 匡 兜 羆布计 眔布瞯 眔布だガ\n"); for (junk = 0; junk < item_num; junk++) { fgets(inbuf, sizeof(inbuf), cfp); - inbuf[(strlen(inbuf) - 1)] = '\0'; + chomp(inbuf); fprintf(tfp, " %-42s %3d 布 %02.2f%% %02.2f%%\n", inbuf + 3, counts[junk], (float)(counts[junk] * 100) / (float)(people_num), (float)(counts[junk] * 100) / (float)(*total)); @@ -494,7 +494,7 @@ vote_view(vote_buffer_t *vbuf, char *bname, int vote_index) for (i = num = 0; i < item_num; i++, num++) { fgets(inbuf, sizeof(inbuf), fp); - inbuf[(strlen(inbuf) - 1)] = '\0'; + chomp(inbuf); inbuf[30] = '\0'; /* truncate */ move(num % 15 + 6, num / 15 * 40); prints(" %-32s%3d 布", inbuf, counts[i]); -- cgit v1.2.3