diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-03-27 20:18:44 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-03-27 20:18:44 +0800 |
commit | f06c7aa81c50445045bc1215bab42bf7839648c5 (patch) | |
tree | 2394d127561d403816d1a43b5103ab31aec2e4a8 /mbbsd/board.c | |
parent | 4fc03474f6c9a27baafdd9e0ab1c4803726b0b0c (diff) | |
download | pttbbs-f06c7aa81c50445045bc1215bab42bf7839648c5.tar pttbbs-f06c7aa81c50445045bc1215bab42bf7839648c5.tar.gz pttbbs-f06c7aa81c50445045bc1215bab42bf7839648c5.tar.bz2 pttbbs-f06c7aa81c50445045bc1215bab42bf7839648c5.tar.lz pttbbs-f06c7aa81c50445045bc1215bab42bf7839648c5.tar.xz pttbbs-f06c7aa81c50445045bc1215bab42bf7839648c5.tar.zst pttbbs-f06c7aa81c50445045bc1215bab42bf7839648c5.zip |
delay init_brdbuf
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1613 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/board.c')
-rw-r--r-- | mbbsd/board.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c index 6427690d..68c5603b 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -55,7 +55,7 @@ brc_putrecord(char *ptr, const char *name, int num, const int *list) static int brc_changed = 0; /* The below two will be filled by read_brc_buf() and brc_update() */ -static char brc_buf[BRC_MAXSIZE]; +static char *brc_buf = NULL; static int brc_size; static char * const fn_boardrc = ".boardrc"; @@ -126,16 +126,17 @@ brc_update(){ brc_insert_record(currboard, brc_num, brc_list); } -static void +inline static void read_brc_buf() { - char dirfile[STRLEN]; - int fd; + if( brc_buf == NULL ){ + char dirfile[STRLEN]; + int fd; - if (brc_buf[0] == '\0') { + brc_buf = malloc(BRC_MAXSIZE); setuserfile(dirfile, fn_boardrc); if ((fd = open(dirfile, O_RDONLY)) != -1) { - brc_size = read(fd, brc_buf, sizeof(brc_buf)); + brc_size = read(fd, brc_buf, BRC_MAXSIZE); close(fd); } else { brc_size = 0; @@ -333,8 +334,14 @@ 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_initial(DEFAULT_BOARD); + set_board(); } void @@ -1430,6 +1437,7 @@ choose_board(int newflag) int root_board() { + init_brdbuf(); class_bid = 1; yank_flag = 1; choose_board(0); @@ -1439,6 +1447,7 @@ root_board() int Boards() { + init_brdbuf(); class_bid = 0; yank_flag = 0; choose_board(0); |