summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-07 08:08:47 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-07 08:08:47 +0800
commit2044b1df081faa18372f8edcb1b4f575b6b4312b (patch)
tree8943d5c4d8ede0ec67a66ab3819564f673553c78 /mbbsd
parentb5fe91ca2e1212db41efbc315dc3acec945e7f28 (diff)
downloadpttbbs-2044b1df081faa18372f8edcb1b4f575b6b4312b.tar
pttbbs-2044b1df081faa18372f8edcb1b4f575b6b4312b.tar.gz
pttbbs-2044b1df081faa18372f8edcb1b4f575b6b4312b.tar.bz2
pttbbs-2044b1df081faa18372f8edcb1b4f575b6b4312b.tar.lz
pttbbs-2044b1df081faa18372f8edcb1b4f575b6b4312b.tar.xz
pttbbs-2044b1df081faa18372f8edcb1b4f575b6b4312b.tar.zst
pttbbs-2044b1df081faa18372f8edcb1b4f575b6b4312b.zip
fix bugs for guest not logining when there're too few online users
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@300 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/cache.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index d2c47fe7..9ee6286b 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -1,4 +1,4 @@
-/* $Id: cache.c,v 1.32 2002/06/06 21:34:11 in2 Exp $ */
+/* $Id: cache.c,v 1.33 2002/06/07 00:08:47 in2 Exp $ */
#include "bbs.h"
#ifndef __FreeBSD__
@@ -454,34 +454,34 @@ userinfo_t *search_ulist_pid(int pid) {
}
return 0;
}
-userinfo_t *search_ulistn(int uid, int unum) {
- register int i=0, j, start = 0, end = SHM->UTMPnumber - 1;
+userinfo_t *search_ulistn(int uid, int unum)
+{
+ register int i = 0, j, start = 0, end = SHM->UTMPnumber - 1;
register userinfo_t **ulist;
if( end == -1 )
return NULL;
ulist=SHM->sorted[SHM->currsorted][6];
- for(i=((start+end)/2); ;i=(start+end)/2)
- {
- j= uid - ulist[i]->uid;
- if(!j)
- {
- for(;i>0 && uid==ulist[i-1]->uid;i--);/* 指到第一筆 */
- if(uid==ulist[i+unum-1]->uid)
- return (userinfo_t *) (ulist[i+unum-1]);
- break; /* 超過範圍 */
- }
- if(end==start)
- {
- break;
- }
- else if(i==start)
- {
- i=end;
- start=end;
- }
- else if(j>0) start = i;
- else end = i;
- }
+ for( i = ((start + end) / 2) ; ; i = (start + end) / 2 ){
+ j = uid - ulist[i]->uid;
+ if( j != 0 ){
+ for( ; i > 0 && uid == ulist[i - 1]->uid ; --i )
+ ; /* 指到第一筆 */
+ if( ulist[i + unum - 1] 1= NULL && uid == ulist[i + num - 1]->uid )
+ return (userinfo_t *)(ulist[i + unum - 1]);
+ break; /* 超過範圍 */
+ }
+ if(end==start){
+ break;
+ }
+ else if(i == start){
+ i = end;
+ start = end;
+ }
+ else if( j > 0 )
+ start = i;
+ else
+ end = i;
+ }
return 0;
}