]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
gindent -br -ce -i4 -ci4 -l80 -nlp -npcs -npsl -d0 -sc -di0 -psl
authorwessels <>
Fri, 3 Nov 2000 23:39:42 +0000 (23:39 +0000)
committerwessels <>
Fri, 3 Nov 2000 23:39:42 +0000 (23:39 +0000)
src/repl/heap/store_heap_replacement.cc
src/repl/heap/store_repl_heap.cc

index 296b61e4974a1aa3595c6f12264e07ed96203082..70f5b2c30f18653857b9f675758696637f21bce2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_heap_replacement.cc,v 1.2 2000/11/03 16:38:46 wessels Exp $
+ * $Id: store_heap_replacement.cc,v 1.3 2000/11/03 16:39:42 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Heap-based replacement
  * AUTHOR: John Dilley
@@ -64,7 +64,8 @@
  * for this to become a problem. (estimation is 10^8 cache
  * turnarounds)
  */
-heap_key HeapKeyGen_StoreEntry_LFUDA(void *entry, double age)
+heap_key 
+HeapKeyGen_StoreEntry_LFUDA(void *entry, double age)
 {
     StoreEntry *e = entry;
     heap_key key;
@@ -77,11 +78,11 @@ heap_key HeapKeyGen_StoreEntry_LFUDA(void *entry, double age)
        tie = 1.0 - exp((double) (e->lastref - squid_curtime) / 86400.0);
     key = age + (double) e->refcount - tie;
     debug(81, 3) ("HeapKeyGen_StoreEntry_LFUDA: %s refcnt=%ld lastref=%ld age=%f tie=%f -> %f\n",
-           storeKeyText(e->hash.key), e->refcount, e->lastref, age, tie, key);
+       storeKeyText(e->hash.key), e->refcount, e->lastref, age, tie, key);
     if (e->mem_obj && e->mem_obj->url)
        debug(81, 3) ("HeapKeyGen_StoreEntry_LFUDA: url=%s\n",
            e->mem_obj->url);
-    return (double)key;
+    return (double) key;
 }
 
 
@@ -104,7 +105,8 @@ heap_key HeapKeyGen_StoreEntry_LFUDA(void *entry, double age)
  * for this to become a problem. (estimation is 10^8 cache
  * turnarounds)
  */
-heap_key HeapKeyGen_StoreEntry_GDSF(void *entry, double age)
+heap_key 
+HeapKeyGen_StoreEntry_GDSF(void *entry, double age)
 {
     StoreEntry *e = entry;
     heap_key key;
@@ -112,7 +114,7 @@ heap_key HeapKeyGen_StoreEntry_GDSF(void *entry, double age)
     double tie = (e->lastref > 1) ? (1.0 / e->lastref) : 1.0;
     key = age + ((double) e->refcount / size) - tie;
     debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: %s size=%f refcnt=%ld lastref=%ld age=%f tie=%f -> %f\n",
-           storeKeyText(e->hash.key), size, e->refcount, e->lastref, age, tie, key);
+       storeKeyText(e->hash.key), size, e->refcount, e->lastref, age, tie, key);
     if (e->mem_obj && e->mem_obj->url)
        debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: url=%s\n",
            e->mem_obj->url);
@@ -126,11 +128,12 @@ heap_key HeapKeyGen_StoreEntry_GDSF(void *entry, double age)
  * Don't use it unless you are trying to compare performance among
  * heap-based replacement policies...
  */
-heap_key HeapKeyGen_StoreEntry_LRU(void *entry, double age)
+heap_key 
+HeapKeyGen_StoreEntry_LRU(void *entry, double age)
 {
     StoreEntry *e = entry;
     debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: %s age=%f lastref=%f\n",
-           storeKeyText(e->hash.key), age, (double)e->lastref);
+       storeKeyText(e->hash.key), age, (double) e->lastref);
     if (e->mem_obj && e->mem_obj->url)
        debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: url=%s\n",
            e->mem_obj->url);
index 5da654ee0935eb07b65904be2642e36d7510fe05..f1d9d771bb24f779ee7b30626a650e0acf6dde66 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_repl_heap.cc,v 1.1 2000/06/08 18:05:40 hno Exp $
+ * $Id: store_repl_heap.cc,v 1.2 2000/11/03 16:39:42 wessels Exp $
  *
  * DEBUG: section ?     HEAP based removal policies
  * AUTHOR: Henrik Nordstrom
@@ -48,9 +48,9 @@ struct _HeapPolicyData {
     heap_key_func *keyfunc;
     int count;
     int nwalkers;
-    enum heap_entry_type
-    { TYPE_UNKNOWN = 0, TYPE_STORE_ENTRY, TYPE_STORE_MEM }
-    type;
+    enum heap_entry_type {
+       TYPE_UNKNOWN = 0, TYPE_STORE_ENTRY, TYPE_STORE_MEM
+    type;
 };
 
 /* Hack to avoid having to remember the RemovalPolicyNode location.
@@ -79,7 +79,7 @@ heap_add(RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node)
     HeapPolicyData *heap = policy->_data;
     assert(!node->data);
     if (EBIT_TEST(entry->flags, ENTRY_SPECIAL))
-       return; /* We won't manage these.. they messes things up */
+       return;                 /* We won't manage these.. they messes things up */
     node->data = heap_insert(heap->heap, entry);
     heap->count += 1;
     if (!heap->type)
@@ -115,8 +115,7 @@ heap_referenced(RemovalPolicy * policy, const StoreEntry * entry,
 /** RemovalPolicyWalker **/
 
 typedef struct _HeapWalkData HeapWalkData;
-struct _HeapWalkData
-{
+struct _HeapWalkData {
     int current;
 };
 
@@ -166,8 +165,7 @@ heap_walkInit(RemovalPolicy * policy)
 /** RemovalPurgeWalker **/
 
 typedef struct _HeapPurgeData HeapPurgeData;
-struct _HeapPurgeData
-{
+struct _HeapPurgeData {
     link_list *locked_entries;
     heap_key min_age;
 };
@@ -206,8 +204,8 @@ heap_purgeDone(RemovalPurgeWalker * walker)
     heap->nwalkers -= 1;
     if (heap_walker->min_age > 0) {
        heap->heap->age = heap_walker->min_age;
-       debug (81, 3) ("heap_purgeDone: Heap age set to %f\n",
-               (double) heap->heap->age);
+       debug(81, 3) ("heap_purgeDone: Heap age set to %f\n",
+           (double) heap->heap->age);
     }
     /*
      * Reinsert the locked entries