From d0cb93f7a0db711d36836126a6c4a5311a639e05 Mon Sep 17 00:00:00 2001 From: in2 Date: Wed, 26 Jun 2002 01:55:30 +0000 Subject: remove old board friend structure, avoid some memory problem of new board friend git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@353 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/board.c | 40 ++-------------------------------------- mbbsd/cache.c | 7 +------ 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/mbbsd/board.c b/mbbsd/board.c index 9b6130b7..5578064d 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -1,4 +1,4 @@ -/* $Id: board.c,v 1.37 2002/06/26 01:12:48 in2 Exp $ */ +/* $Id: board.c,v 1.38 2002/06/26 01:55:30 in2 Exp $ */ #include "bbs.h" #define BRC_STRLEN 15 /* Length of board name */ #define BRC_MAXSIZE 24576 @@ -649,45 +649,9 @@ static void dozap(int num){ zapbuf[ptr->bid-1] = (ptr->myattr&BRD_ZAP?0:login_start_time); } -void delutmpbid(int bid, userinfo_t *utmp) -{ - userinfo_t *u; - while( SHM->Bbusystate || now - SHM->busystate_b[bid - 1] < 5 ) - sleep(1); - // Ptt:有問題都是這邊沒有執行到就爛掉了 - - SHM->busystate_b[bid-1] = now; - u = bcache[bid - 1].u; - if( u != (void *)utmp ){ - for( ; u && u->nextbfriend != (void*)utmp; u = u->nextbfriend ) - ; - if( u ) - u->nextbfriend = utmp->nextbfriend; - } - else - bcache[bid - 1].u = utmp->nextbfriend; - if( bcache[bid - 1].nuser > 0 ) - bcache[bid - 1].nuser--; - SHM->busystate_b[bid - 1] = 0; -} - void setutmpbid(int bid) { - if(currutmp->brc_id) - { - delutmpbid(currutmp->brc_id, currutmp); - } - if(bid) - { - bcache[bid-1].nuser++; - currutmp->nextbfriend=bcache[bid-1].u; - bcache[bid-1].u=(void*)currutmp; - } - else - { - currutmp->nextbfriend=0; - } - currutmp->brc_id=bid; + currutmp->brc_id=bid; } static void choose_board(int newflag) { diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 9f62424b..9b14eb8a 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.38 2002/06/26 01:43:01 in2 Exp $ */ +/* $Id: cache.c,v 1.39 2002/06/26 01:55:30 in2 Exp $ */ #include "bbs.h" #ifndef __FreeBSD__ @@ -623,8 +623,6 @@ static void reload_bcache() { log_usies("CACHE", "reload bcache"); sort_bcache(); for( i = 0 ; i < SHM->Bnumber ; ++i ){ - bcache[i].u=NULL; - bcache[i].nuser=0; bcache[i].firstchild[0]=NULL; bcache[i].firstchild[1]=NULL; } @@ -654,7 +652,6 @@ void addbrd_touchcache() #if !defined(_BBS_UTIL_C_) void reset_board(int bid) { /* Ptt: 這樣就不用老是touch board了 */ int fd,i,nuser; - void *u; boardheader_t *bhdr; @@ -665,7 +662,6 @@ void reset_board(int bid) { /* Ptt: } else { SHM->busystate_b[bid-1] = now; nuser = bcache[bid-1].nuser; - u = bcache[bid-1].u; bhdr = bcache; bhdr += bid; @@ -681,7 +677,6 @@ void reset_board(int bid) { /* Ptt: bcache[i].firstchild[1]=NULL; } nuser = bcache[bid-1].nuser; - u = bcache[bid-1].u; SHM->busystate_b[bid-1] = 0; } } -- cgit v1.2.3