summaryrefslogtreecommitdiffstats
path: root/mbbsd/board.c
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-03-28 16:34:25 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-03-28 16:34:25 +0800
commit6b4ec3825a16382b8aa309a128305b0b09ab520c (patch)
tree83395de6f46839cf2ebd69a7957e80c2b64aba87 /mbbsd/board.c
parent76e359f7c4fd25f803ef9f6553c685ad6ae86af2 (diff)
downloadpttbbs-6b4ec3825a16382b8aa309a128305b0b09ab520c.tar
pttbbs-6b4ec3825a16382b8aa309a128305b0b09ab520c.tar.gz
pttbbs-6b4ec3825a16382b8aa309a128305b0b09ab520c.tar.bz2
pttbbs-6b4ec3825a16382b8aa309a128305b0b09ab520c.tar.lz
pttbbs-6b4ec3825a16382b8aa309a128305b0b09ab520c.tar.xz
pttbbs-6b4ec3825a16382b8aa309a128305b0b09ab520c.tar.zst
pttbbs-6b4ec3825a16382b8aa309a128305b0b09ab520c.zip
Correcting action about make brc_buf be malloc.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1620 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/board.c')
-rw-r--r--mbbsd/board.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c
index dc28ad8d..525cc020 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -17,7 +17,7 @@ static time_t brc_expire_time;
static int brc_changed = 0;
/* The below two will be filled by read_brc_buf() and brc_update() */
-char *brc_buf = NULL;
+static char *brc_buf = NULL;
static int brc_size;
static char * const fn_boardrc = ".boardrc";
@@ -164,6 +164,16 @@ brc_finalize(){
}
}
+void
+brc_initialize(){
+ static char done = 0;
+ if( done )
+ return;
+ done = 1;
+ brc_expire_time = login_start_time - 365 * 86400;
+ read_brc_buf();
+}
+
int
brc_read_record(const char* bname, int* num, int* list){
char *ptr;
@@ -184,9 +194,12 @@ brc_read_record(const char* bname, int* num, int* list){
int
brc_initial_board(const char *boardname)
{
+ brc_initialize();
+
if (strcmp(currboard, boardname) == 0) {
return brc_num;
}
+
brc_update(); /* write back first */
strlcpy(currboard, boardname, sizeof(currboard));
currbid = getbnum(currboard);
@@ -344,12 +357,7 @@ void load_brdbuf(void)
void
init_brdbuf()
{
- static char done = 0;
- if( done )
- return;
- done = 1;
- brc_expire_time = login_start_time - 365 * 86400;
- read_brc_buf();
+ brc_initialize();
brc_initial_board(DEFAULT_BOARD);
set_board();
}