diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-03-28 16:34:25 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-03-28 16:34:25 +0800 |
commit | 6b4ec3825a16382b8aa309a128305b0b09ab520c (patch) | |
tree | 83395de6f46839cf2ebd69a7957e80c2b64aba87 | |
parent | 76e359f7c4fd25f803ef9f6553c685ad6ae86af2 (diff) | |
download | pttbbs-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
-rw-r--r-- | mbbsd/bbs.c | 3 | ||||
-rw-r--r-- | mbbsd/board.c | 22 |
2 files changed, 16 insertions, 9 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 5194d414..3758de88 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -2621,9 +2621,8 @@ Read() #ifdef LOG_BOARD time_t usetime = now; #endif - extern char *brc_buf; - if( !brc_buf ) + if ( ! currboard[0] ) return 0; setutmpmode(READING); 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(); } |