summaryrefslogtreecommitdiffstats
path: root/mbbsd/record.c
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-08-19 03:55:59 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-08-19 03:55:59 +0800
commitef982e5c13120616dbfb32552d74deba348c27a1 (patch)
treec3e5571432de4f0baa04b8d69b379f7db340c2b7 /mbbsd/record.c
parent0c5a863ffc1fba8867bed7e2b49f82afa12fcd7b (diff)
downloadpttbbs-ef982e5c13120616dbfb32552d74deba348c27a1.tar
pttbbs-ef982e5c13120616dbfb32552d74deba348c27a1.tar.gz
pttbbs-ef982e5c13120616dbfb32552d74deba348c27a1.tar.bz2
pttbbs-ef982e5c13120616dbfb32552d74deba348c27a1.tar.lz
pttbbs-ef982e5c13120616dbfb32552d74deba348c27a1.tar.xz
pttbbs-ef982e5c13120616dbfb32552d74deba348c27a1.tar.zst
pttbbs-ef982e5c13120616dbfb32552d74deba348c27a1.zip
get rid of linear search in getindex
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3065 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/record.c')
-rw-r--r--mbbsd/record.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 5cb74cd4..f244876a 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -191,30 +191,6 @@ getindex(const char *direct, fileheader_t *fhdr, int end)
close(fd);
return -i;
}
- else{
- /* 上面的 binary search 爛掉了, 那就改用 linear search */
-#ifndef _BBS_UTIL_C_
- log_file("getindexerror", LOG_CREAT | LOG_VF,
- "%s try to find: %d final i:%d\n",
- direct, stamp, i);
-#endif
- // Ptt: log if there is still forever loop.
-
- end = get_num_records(direct, sizeof(fileheader_t));
- for( i = 1 ; i <= end ; ++i ){
- if( get_record_keep(direct, &fh,
- sizeof(fileheader_t), i, &fd)==-1 ){
- if( fd != -1 )
- close(fd);
- return 0;
- }
- if( atoi(fh.filename + 2) == stamp ){
- close(fd);
- fhdr->multi.money = fh.multi.money;
- return i;
- }
- }
- }
if( fd != -1 )
close(fd);
return 0;