Updated confusing and jumbled source formatting to something approximating OpenBSD's Kernel Normal Form

Used GNU indent with the following options: -nbad -nbap -bbb -nbc -br -brs -c33 -cd33 -cdb -ce -ci4 -cli0 -di16 -fc1 -fca -hnl -i8 -ip4 -l79 -lp -npcs -nprs -psl -saf -sai -saw -sc -nsob -nss -ts8
This commit is contained in:
tedbullock 2007-07-13 04:20:48 +00:00
parent debafb721b
commit 991cc96c68

View File

@ -1,35 +1,33 @@
/*
httperf -- a tool for measuring web server performance
Copyright 2000-2007 Hewlett-Packard Company and Contributors listed in
AUTHORS file. Originally contributed by David Mosberger-Tang
This file is part of httperf, a web server performance measurment
tool.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
In addition, as a special exception, the copyright holders give
permission to link the code of this work with the OpenSSL project's
"OpenSSL" library (or with modified versions of it that use the same
license as the "OpenSSL" library), and distribute linked combinations
including the two. You must obey the GNU General Public License in
all respects for all of the code used other than "OpenSSL". If you
modify this file, you may extend this exception to your version of the
file, but you are not obligated to do so. If you do not wish to do
so, delete this exception statement from your version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA
* httperf -- a tool for measuring web server performance Copyright 2000-2007
* Hewlett-Packard Company and Contributors listed in AUTHORS file. Originally
* contributed by David Mosberger-Tang
*
* This file is part of httperf, a web server performance measurment tool.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* In addition, as a special exception, the copyright holders give permission
* to link the code of this work with the OpenSSL project's "OpenSSL" library
* (or with modified versions of it that use the same license as the "OpenSSL"
* library), and distribute linked combinations including the two. You must
* obey the GNU General Public License in all respects for all of the code
* used other than "OpenSSL". If you modify this file, you may extend this
* exception to your version of the file, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
@ -52,7 +50,9 @@ static Time next_tick;
static Timer *timer_free_list = 0;
static Timer *t_curr = 0;
/* What a wheel is made of, no? */
/*
* What a wheel is made of, no?
*/
static Timer_Queue wheel[WHEEL_SIZE], *curr = 0;
static void
@ -99,10 +99,8 @@ timer_tick (void)
now = timer_now_forced();
while (timer_now () >= next_tick)
{
for (t = curr->next; t && t->delta == 0; t = t_next)
{
while (timer_now() >= next_tick) {
for (t = curr->next; t && t->delta == 0; t = t_next) {
t_curr = t;
(*t->func) (t, t->arg);
t_next = t->q.next;
@ -110,8 +108,7 @@ timer_tick (void)
}
t_curr = 0;
curr->next = t;
if (t)
{
if (t) {
t->q.prev = (Timer *) curr;
--t->delta;
}
@ -130,16 +127,12 @@ timer_schedule (Timer_Callback timeout, Any_Type arg, Time delay)
u_long delta;
Time behind;
if (timer_free_list)
{
if (timer_free_list) {
t = timer_free_list;
timer_free_list = t->q.next;
}
else
{
} else {
t = malloc(sizeof(*t));
if (!t)
{
if (!t) {
fprintf(stderr, "%s.timer_schedule: %s\n",
prog_name, strerror(errno));
return 0;
@ -155,9 +148,9 @@ timer_schedule (Timer_Callback timeout, Any_Type arg, Time delay)
if (delay < 0.0)
ticks = 1;
else
{
ticks = (delay + TIMER_INTERVAL / 2.0) * (1.0 / TIMER_INTERVAL);
else {
ticks =
(delay + TIMER_INTERVAL / 2.0) * (1.0 / TIMER_INTERVAL);
if (!ticks)
ticks = 1; /* minimum delay is a tick */
}
@ -168,8 +161,7 @@ timer_schedule (Timer_Callback timeout, Any_Type arg, Time delay)
delta = ticks / WHEEL_SIZE;
p = (Timer *) spoke;
while (p->q.next && delta > p->q.next->delta)
{
while (p->q.next && delta > p->q.next->delta) {
delta -= p->q.next->delta;
p = p->q.next;
}
@ -177,8 +169,7 @@ timer_schedule (Timer_Callback timeout, Any_Type arg, Time delay)
t->q.prev = p;
p->q.next = t;
t->delta = delta;
if (t->q.next)
{
if (t->q.next) {
t->q.next->q.prev = t;
t->q.next->delta -= delta;
}
@ -198,16 +189,17 @@ timer_cancel (Timer *t)
assert(t->q.prev);
/* A module MUST NOT call timer_cancel() for a timer that is
currently being processed (whose timeout has expired). */
if (t_curr == t)
{
fprintf (stderr, "timer_cancel() called on currently active timer!\n");
/*
* A module MUST NOT call timer_cancel() for a timer that is currently
* being processed (whose timeout has expired).
*/
if (t_curr == t) {
fprintf(stderr,
"timer_cancel() called on currently active timer!\n");
return;
}
if (t->q.next)
{
if (t->q.next) {
t->q.next->delta += t->delta;
t->q.next->q.prev = t->q.prev;
}