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