]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
gindent
authorwessels <>
Tue, 25 Feb 1997 23:09:08 +0000 (23:09 +0000)
committerwessels <>
Tue, 25 Feb 1997 23:09:08 +0000 (23:09 +0000)
include/splay.h
include/tempnam.h
lib/splay.c
lib/strerror.c
src/neighbors.cc
src/store.cc

index 00ad46035be1008b015e961911b44bde2d62e67d..dc62d37339763eff9a7bb7500483d4cd3b481107 100644 (file)
@@ -1,8 +1,8 @@
 
 typedef struct _splay_node {
-       void *data;
-       struct _splay_node *left;
-       struct _splay_node *right;
+    void *data;
+    struct _splay_node *left;
+    struct _splay_node *right;
 } splayNode;
 
 typedef int (*SPCMP) _PARAMS((const void *, splayNode *));
@@ -11,5 +11,4 @@ extern int splayLastResult;
 
 splayNode *splay_insert _PARAMS((void *, splayNode *, SPCMP));
 splayNode *splay_splay _PARAMS((const void *, splayNode *, SPCMP));
-void splay_destroy _PARAMS((splayNode *, void (*) _PARAMS((void *))));
-
+void splay_destroy _PARAMS((splayNode *, void (*)_PARAMS((void *))));
index e69219fe95c4766bfc996b2717d033f55bc00e2c..d12a7f7d9785d28b81d20c85e4f2ca4e39a24af1 100644 (file)
@@ -1,3 +1,4 @@
+
 /* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  * This file is part of the GNU C Library.
  * The GNU C Library is free software; you can redistribute it and/or
index 167e065526c4e1b15a46c7587a74b3ee15837079..34ae484b8f0e49a84aa12152276e5b5d1c967446 100644 (file)
 int splayLastResult = 0;
 
 splayNode *
-splay_insert (void *data, splayNode *top, SPCMP compare)
+splay_insert(void *data, splayNode * top, SPCMP compare)
 {
     splayNode *new = xcalloc(sizeof(splayNode), 1);
     new->data = data;
     if (top == NULL) {
-        new->left = new->right = NULL;
-        return new;
+       new->left = new->right = NULL;
+       return new;
     }
     top = splay_splay(data, top, compare);
     if (splayLastResult < 0) {
-        new->left = top->left;
-        new->right = top;
-        top->left = NULL;
-        return new;
+       new->left = top->left;
+       new->right = top;
+       top->left = NULL;
+       return new;
     } else if (splayLastResult > 0) {
-        new->right = top->right;
-        new->left = top;
-        top->right = NULL;
-        return new;
+       new->right = top->right;
+       new->left = top;
+       top->right = NULL;
+       return new;
     } else {
        /* duplicate entry */
-        free(new);
-        return top;
+       free(new);
+       return top;
     }
 }
 
 splayNode *
-splay_splay (const void *data, splayNode *top, SPCMP compare)
+splay_splay(const void *data, splayNode * top, SPCMP compare)
 {
     splayNode N;
     splayNode *l;
     splayNode *r;
     splayNode *y;
     if (top == NULL)
-        return top;
+       return top;
     N.left = N.right = NULL;
     l = r = &N;
 
     for (;;) {
-        splayLastResult = compare(data, top);
-        if (splayLastResult < 0) {
-            if (top->left == NULL)
-                break;
-            if ((splayLastResult = compare(data, top->left)) < 0) {
-                y = top->left;    /* rotate right */
-                top->left = y->right;
-                y->right = top;
-                top = y;
-                if (top->left == NULL)
-                    break;
-            }
-            r->left = top;        /* link right */
-            r = top;
-            top = top->left;
-        } else if (splayLastResult > 0) {
-            if (top->right == NULL)
-                break;
-            if ((splayLastResult = compare(data, top->right)) > 0) {
-                y = top->right;   /* rotate left */
-                top->right = y->left;
-                y->left = top;
-                top = y;
-                if (top->right == NULL)
-                    break;
-            }
-            l->right = top;       /* link left */
-            l = top;
-            top = top->right;
-        } else {
-            break;
-        }
+       splayLastResult = compare(data, top);
+       if (splayLastResult < 0) {
+           if (top->left == NULL)
+               break;
+           if ((splayLastResult = compare(data, top->left)) < 0) {
+               y = top->left;  /* rotate right */
+               top->left = y->right;
+               y->right = top;
+               top = y;
+               if (top->left == NULL)
+                   break;
+           }
+           r->left = top;      /* link right */
+           r = top;
+           top = top->left;
+       } else if (splayLastResult > 0) {
+           if (top->right == NULL)
+               break;
+           if ((splayLastResult = compare(data, top->right)) > 0) {
+               y = top->right; /* rotate left */
+               top->right = y->left;
+               y->left = top;
+               top = y;
+               if (top->right == NULL)
+                   break;
+           }
+           l->right = top;     /* link left */
+           l = top;
+           top = top->right;
+       } else {
+           break;
+       }
     }
-    l->right = top->left;         /* assemble */
+    l->right = top->left;      /* assemble */
     r->left = top->right;
     top->left = N.right;
     top->right = N.left;
@@ -98,60 +98,60 @@ splay_splay (const void *data, splayNode *top, SPCMP compare)
 }
 
 void
-splay_destroy(splayNode *top, void (*free_func) _PARAMS((void *)))
+splay_destroy(splayNode * top, void (*free_func) _PARAMS((void *)))
 {
-       if (top->left)
-               splay_destroy(top->left, free_func);
-       if (top->right)
-               splay_destroy(top->right, free_func);
-       free_func(top->data);
-       xfree(top);
+    if (top->left)
+       splay_destroy(top->left, free_func);
+    if (top->right)
+       splay_destroy(top->right, free_func);
+    free_func(top->data);
+    xfree(top);
 }
 
 
 #ifdef DRIVER
 
 void
-splay_print(splayNode *top, void (*printfunc)())
+splay_print(splayNode * top, void (*printfunc) ())
 {
-       if (top == NULL)
-               return;
-       splay_print(top->left, printfunc);
-       printfunc(top->data);
-       splay_print(top->right, printfunc);
+    if (top == NULL)
+       return;
+    splay_print(top->left, printfunc);
+    printfunc(top->data);
+    splay_print(top->right, printfunc);
 }
 
 typedef struct {
-       int i;
+    int i;
 } intnode;
 
 int
-compareint (void *a, splayNode *n)
+compareint(void *a, splayNode * n)
 {
-       intnode *A = a;
-       intnode *B = n->data;
-       return A->i - B->i;
+    intnode *A = a;
+    intnode *B = n->data;
+    return A->i - B->i;
 }
 
 void
-printint (void *a)
+printint(void *a)
 {
-       intnode *A = a;
-       printf ("%d\n", A->i);
+    intnode *A = a;
+    printf("%d\n", A->i);
 }
 
 main(int argc, char *argv[])
 {
-       int i;
-       intnode *I;
-       splayNode *top = NULL;
-       srandom(time(NULL));
-       for (i=0; i< 100; i++) {
-               I = xcalloc (sizeof(intnode), 1);
-               I->i = random();
-               top = splay_insert(I, top, compareint);
-       }
-       splay_print (top, printint);
-       return 0;
+    int i;
+    intnode *I;
+    splayNode *top = NULL;
+    srandom(time(NULL));
+    for (i = 0; i < 100; i++) {
+       I = xcalloc(sizeof(intnode), 1);
+       I->i = random();
+       top = splay_insert(I, top, compareint);
+    }
+    splay_print(top, printint);
+    return 0;
 }
 #endif
index daa29b436805b4a0a1cf62b2f1b8033ab6832f33..a51e2630ad40a6bbde443ff3bc9c4fce678de218 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: strerror.c,v 1.1 1997/02/25 05:44:13 wessels Exp $
+ * $Id: strerror.c,v 1.2 1997/02/25 16:09:10 wessels Exp $
  *
  * DEBUG: 
  * AUTHOR: Duane Wessels
@@ -42,5 +42,5 @@ extern char *sys_errlist[];
 char *
 strerror(int ern)
 {
-       return sys_errlist[ern];
+    return sys_errlist[ern];
 }
index 7245a95d626c55afc77e8d6bd43ed2d40d3a9bba..fab1047772131058e7b0cd7889cf3046f3f43bf8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: neighbors.cc,v 1.121 1997/02/25 00:18:52 wessels Exp $
+ * $Id: neighbors.cc,v 1.122 1997/02/25 16:09:12 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -114,7 +114,7 @@ static void neighborAlive _PARAMS((peer *, const MemObject *, const icp_common_t
 static void neighborCountIgnored _PARAMS((peer * e, icp_opcode op_unused));
 static neighbor_t parseNeighborType _PARAMS((const char *s));
 static void peerRefreshDNS _PARAMS((void *));
-static void peerDNSConfigure _PARAMS((int fd, const ipcache_addrs *ia, void *data));
+static void peerDNSConfigure _PARAMS((int fd, const ipcache_addrs * ia, void *data));
 
 static icp_common_t echo_hdr;
 static u_short echo_port;
@@ -964,15 +964,15 @@ peerUpdateFudge(void *unused)
 }
 
 static void
-peerDNSConfigure(int fd, const ipcache_addrs *ia, void *data)
+peerDNSConfigure(int fd, const ipcache_addrs * ia, void *data)
 {
     peer *e = data;
     struct sockaddr_in *ap;
     int j;
     if (e->n_addresses == 0) {
-        debug(15, 1, "Configuring %s %s/%d/%d\n", neighborTypeStr(e),
+       debug(15, 1, "Configuring %s %s/%d/%d\n", neighborTypeStr(e),
            e->host, e->http_port, e->icp_port);
-        if (e->type == PEER_MULTICAST)
+       if (e->type == PEER_MULTICAST)
            debug(15, 1, "    Multicast TTL = %d\n", e->mcast_ttl);
     }
     e->n_addresses = 0;
index da26b9e2e599f0e41e9b543bc4904f75e3a55ddd..cf0337461003127eed990bb6462a0815bb039601 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.211 1997/02/25 00:19:11 wessels Exp $
+ * $Id: store.cc,v 1.212 1997/02/25 16:09:13 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -593,7 +593,7 @@ storeUnlockObject(StoreEntry * e)
        return (int) e->lock_count;
     if (e->store_status == STORE_PENDING) {
        debug_trap("storeUnlockObject: Someone unlocked STORE_PENDING object");
-       debug(20,1,"   --> Key '%s'\n", e->key);
+       debug(20, 1, "   --> Key '%s'\n", e->key);
        e->store_status = STORE_ABORTED;
     }
     if (BIT_TEST(e->flag, RELEASE_REQUEST)) {