From d08db5565702465469052e01d06ff76194d03cd4 Mon Sep 17 00:00:00 2001 From: ptt Date: Wed, 14 Apr 2004 11:41:27 +0000 Subject: remove dircache prevent error for push bottom git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1758 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/cache.c | 79 ----------------------------------------------------------- 1 file changed, 79 deletions(-) (limited to 'mbbsd/cache.c') diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 0d551669..0d542ba5 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -507,80 +507,6 @@ void touchbtotal(int bid) { SHM->lastposttime[bid - 1] = 0; } -void -touchdircache(int bid) -{ -#if DIRCACHESIZE - int *i = (int *)&SHM->dircache[bid - 1][0].filename[0]; - *i = 0; -#endif -} - -#if DIRCACHESIZE -void -load_fileheader_bottom_cache(int bid, char *bottompath) -{ - int num = getbtotal(bid), n_bottom = getbottomtotal(bid); - int n = num - DIRCACHESIZE + n_bottom + 1; - int dirsize = DIRCACHESIZE-n_bottom; - if (n<1) - { - n=1; - dirsize=num; - } - if(n_bottom) - { - get_records(bottompath, &SHM->dircache[bid - 1][dirsize], - sizeof(fileheader_t), 1, n_bottom); - } -} -void -load_fileheader_cache(int bid, char *direct) -{ - int num = getbtotal(bid), n_bottom = getbottomtotal(bid); - int n = num - DIRCACHESIZE + n_bottom + 1; - int dirsize = DIRCACHESIZE-n_bottom; - if (n<1) - { - n=1; - dirsize=num; - } - if (SHM->Bbusystate != 1 && COMMON_TIME - SHM->busystate_b[bid - 1] >= 10) { - SHM->busystate_b[bid - 1] = COMMON_TIME; - get_records(direct, SHM->dircache[bid - 1], - sizeof(fileheader_t), n, dirsize); - SHM->busystate_b[bid - 1] = 0; - } else { - safe_sleep(1); - } -} - -int -get_fileheader_cache(int bid, char *direct, fileheader_t * headers, - int recbase, int nlines) -{ - int ret, n, num; - - num = getbtotal(bid)+getbottomtotal(bid); - - ret = num - recbase + 1, - n = (num - DIRCACHESIZE + 1); - - - if (SHM->dircache[bid - 1][0].filename[0] == '\0') - load_fileheader_cache(bid, direct); - if (n < 1) - n = recbase - 1; - else - n = recbase - n; - if (n < 0) - n = 0; - if (ret > nlines) - ret = nlines; - memcpy(headers, &(SHM->dircache[bid - 1][n]), sizeof(fileheader_t) * ret); - return ret; -} -#endif static int cmpboardname(boardheader_t ** brd, boardheader_t ** tmp) @@ -731,9 +657,6 @@ setbottomtotal(int bid) char genbuf[256]; setbfile(genbuf, bh->brdname, ".DIR.bottom"); SHM->n_bottom[bid-1]=get_num_records(genbuf, sizeof(fileheader_t)); -#if DIRCACHESIZE - load_fileheader_bottom_cache(currbid, genbuf); -#endif } void setbtotal(int bid) @@ -758,8 +681,6 @@ setbtotal(int bid) } else SHM->lastposttime[bid - 1] = 0; close(fd); - if (num) - touchdircache(bid); } void -- cgit v1.2.3