From 130d45bfc935da1702a7b5c246a099ea3b4a0bdf Mon Sep 17 00:00:00 2001 From: "Tomas Chvatal (scarabeus)" Date: Wed, 22 Oct 2008 22:53:48 +0200 Subject: Ident all code correctly. --- src/base/protect.c | 96 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 46 deletions(-) (limited to 'src/base/protect.c') diff --git a/src/base/protect.c b/src/base/protect.c index e83c1ec..acfc1e3 100644 --- a/src/base/protect.c +++ b/src/base/protect.c @@ -8,68 +8,72 @@ #include "myTimer.h" #include "protect.h" -protect_t* newProtect() +protect_t * +newProtect() { - protect_t *new; - new = malloc( sizeof(protect_t) ); - new->lastMove = getMyTime(); - new->lastPing = getMyTime(); - new->avarage = 0; - new->count = 0; - new->isDown = FALSE; - return new; + protect_t *new; + new = malloc(sizeof(protect_t)); + new->lastMove = getMyTime(); + new->lastPing = getMyTime(); + new->avarage = 0; + new->count = 0; + new->isDown = FALSE; + return new; } -void refreshLastMove(protect_t *p) +void +refreshLastMove(protect_t * p) { - my_time_t currentTime; - my_time_t interval; + my_time_t currentTime; + my_time_t interval; - currentTime = getMyTime(); - interval = currentTime - p->lastMove; - p->lastMove = getMyTime(); - p->avarage += interval; - p->count++; - if (p->count == PROTECT_SPEED_AVARAGE) { - int index; + currentTime = getMyTime(); + interval = currentTime - p->lastMove; + p->lastMove = getMyTime(); + p->avarage += interval; + p->count++; + if (p->count == PROTECT_SPEED_AVARAGE) { + int index; - index = p->avarage/PROTECT_SPEED_AVARAGE; - p->avarage = 0; - p->count = 0; + index = p->avarage / PROTECT_SPEED_AVARAGE; + p->avarage = 0; + p->count = 0; #if 0 - if( index < PROTECT_SPEED_INTERVAL_TIMEOUT ) - { - p->isDown = TRUE; - } + if (index < PROTECT_SPEED_INTERVAL_TIMEOUT) { + p->isDown = TRUE; + } #endif - //printf("speed index = %d\n", index); - } + //printf("speed index = %d\n", index); + } } -void rereshLastPing(protect_t *p) +void +rereshLastPing(protect_t * p) { - //my_time_t currentTime; - //my_time_t interval; - //currentTime = getMyTime(); - //interval = currentTime - p->lastPing; - p->lastPing = getMyTime(); - //printf("interval = %d\n", interval); + //my_time_t currentTime; + //my_time_t interval; + //currentTime = getMyTime(); + //interval = currentTime - p->lastPing; + p->lastPing = getMyTime(); + //printf("interval = %d\n", interval); } -bool_t isDown(protect_t *p) +bool_t +isDown(protect_t * p) { - my_time_t currentTime; - my_time_t interval; + my_time_t currentTime; + my_time_t interval; - currentTime = getMyTime(); - interval = currentTime - p->lastPing; - if (interval > PROTECT_PING_INTERVAL_TIMEOUT) - p->isDown = TRUE; - return p->isDown; + currentTime = getMyTime(); + interval = currentTime - p->lastPing; + if (interval > PROTECT_PING_INTERVAL_TIMEOUT) + p->isDown = TRUE; + return p->isDown; } -void destroyProtect(protect_t *p) +void +destroyProtect(protect_t * p) { - assert( p != NULL ); - free(p); + assert(p != NULL); + free(p); } -- cgit v1.2.3