summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-01-17 15:14:14 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-01-17 15:14:14 +0800
commit30ba9e94f8966a9769215b7db1515f32bcbee80e (patch)
treed0b88bc1b6a5e941cd00a804248e829a112f7e5d
parentb4af03248cb1ab7117932302115d6eb670a5dfe4 (diff)
downloadpttbbs-30ba9e94f8966a9769215b7db1515f32bcbee80e.tar
pttbbs-30ba9e94f8966a9769215b7db1515f32bcbee80e.tar.gz
pttbbs-30ba9e94f8966a9769215b7db1515f32bcbee80e.tar.bz2
pttbbs-30ba9e94f8966a9769215b7db1515f32bcbee80e.tar.lz
pttbbs-30ba9e94f8966a9769215b7db1515f32bcbee80e.tar.xz
pttbbs-30ba9e94f8966a9769215b7db1515f32bcbee80e.tar.zst
pttbbs-30ba9e94f8966a9769215b7db1515f32bcbee80e.zip
Use realloc. Don't malloc, memcpy, and free.
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@618 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/board.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 58444c27..fa57f806 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1,4 +1,4 @@
-/* $Id: board.c,v 1.70 2003/01/17 07:10:54 kcwu Exp $ */
+/* $Id: board.c,v 1.71 2003/01/17 07:14:14 kcwu Exp $ */
#include "bbs.h"
#define BRC_STRLEN 15 /* Length of board name */
#define BRC_MAXSIZE 24576
@@ -518,7 +518,6 @@ load_boards(char *key)
}
brdnum = 0;
if (class_bid <= 0) {
- boardstat_t *tmp = NULL;
nbrd = (boardstat_t *) malloc(sizeof(boardstat_t) * numboards);
for (i = 0; i < numboards; i++) {
if ((bptr = SHM->bsorted[type][i]) == NULL)
@@ -535,10 +534,7 @@ load_boards(char *key)
}
if (class_bid == -1)
qsort(nbrd, brdnum, sizeof(boardstat_t), cmpboardfriends);
- tmp = (boardstat_t *) malloc(sizeof(boardstat_t) * brdnum);
- memcpy(tmp, nbrd, sizeof(boardstat_t) * brdnum);
- free(nbrd);
- nbrd = tmp;
+ nbrd = realloc(nbrd, sizeof(boardstat_t) * brdnum);
} else {
nbrd = (boardstat_t *) malloc(bptr->childcount * sizeof(boardstat_t));
for (bptr = bptr->firstchild[type]; bptr != (boardheader_t *) ~ 0;