summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-12-05 11:33:26 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-12-05 11:33:26 +0800
commit42623d301183c080a095791fd5ada478f812d272 (patch)
treed81e5c52ab700fafc6c2b4cf27ba40694be64652
parent10d9931212b7fa65cb062bbd9ec8714877b651ce (diff)
downloadpttbbs-42623d301183c080a095791fd5ada478f812d272.tar
pttbbs-42623d301183c080a095791fd5ada478f812d272.tar.gz
pttbbs-42623d301183c080a095791fd5ada478f812d272.tar.bz2
pttbbs-42623d301183c080a095791fd5ada478f812d272.tar.lz
pttbbs-42623d301183c080a095791fd5ada478f812d272.tar.xz
pttbbs-42623d301183c080a095791fd5ada478f812d272.tar.zst
pttbbs-42623d301183c080a095791fd5ada478f812d272.zip
user could remove dircache if need (not tested)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1396 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/config.h5
-rw-r--r--include/pttstruct.h2
-rw-r--r--mbbsd/cache.c4
-rw-r--r--mbbsd/read.c4
4 files changed, 14 insertions, 1 deletions
diff --git a/include/config.h b/include/config.h
index c3d7d2fa..4958b24f 100644
--- a/include/config.h
+++ b/include/config.h
@@ -93,8 +93,11 @@
#define MAX_EXKEEPMAIL (1000) /* 程獺絚ぶ */
#endif
-/* 临ゼ俱瞶 */
+#ifndef DIRCACHESIZE
#define DIRCACHESIZE (40) /* cache ゅ彻い程40絞 */
+#endif
+
+/* 临ゼ俱瞶 */
#define MAX_FRIEND (256) /* 更 cache ぇ程狟ね计ヘ */
#define MAX_REJECT (32) /* 更 cache ぇ程胊计ヘ */
#define MAX_MSGS (10) /* 瞴(荐癟)г瑻 */
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 9b9efe72..7ec5fd3d 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -362,7 +362,9 @@ typedef struct {
int BMcache[MAX_BOARD][MAX_BMs];
boardheader_t bcache[MAX_BOARD];
boardheader_t *bsorted[2][MAX_BOARD]; /* 0: by name 1: by class */
+#if DIRCACHESIZE
fileheader_t dircache[MAX_BOARD][DIRCACHESIZE];
+#endif
time_t busystate_b[MAX_BOARD];
int total[MAX_BOARD];
int hbfl[MAX_BOARD][MAX_FRIEND + 1];
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index 7059d4e2..cacdb1d7 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -509,10 +509,13 @@ void touchbtotal(int bid) {
void
touchdircache(int bid)
{
+#if DIRCACHESIZE
int *i = (int *)&SHM->dircache[bid - 1][0].filename[0];
*i = 0;
+#endif
}
+#if DIRCACHESIZE
void
load_fileheader_cache(int bid, char *direct)
{
@@ -553,6 +556,7 @@ get_fileheader_cache(int bid, char *direct, fileheader_t * headers,
memcpy(headers, &(SHM->dircache[bid - 1][n]), sizeof(fileheader_t) * ret);
return ret;
}
+#endif
static int
cmpboardname(boardheader_t ** brd, boardheader_t ** tmp)
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 8ad1b32e..bcb596af 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -892,12 +892,14 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey
recbase = 1;
locmem->top_ln = recbase;
}
+#if DIRCACHESIZE
if( bidcache > 0 &&
!(currmode & (MODE_SELECT | MODE_DIGEST)) &&
(last_line - recbase) < DIRCACHESIZE )
entries = get_fileheader_cache(currbid, currdirect,
headers, recbase, p_lines);
else
+#endif
entries = get_records(currdirect, headers, FHSZ, recbase,
p_lines);
}
@@ -971,11 +973,13 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey
} else if (reload) {
recbase = locmem->top_ln;
+#if DIRCACHESIZE
if (bidcache > 0 && !(currmode & (MODE_SELECT | MODE_DIGEST))
&& last_line - recbase < DIRCACHESIZE)
entries = get_fileheader_cache(currbid, currdirect,
headers, recbase, p_lines);
else
+#endif
entries = get_records(currdirect, headers, FHSZ, recbase,
p_lines);