httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwool...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental cache_pqueue.c cache_pqueue.h
Date Wed, 14 Aug 2002 00:07:45 GMT
jwoolley    2002/08/13 17:07:45

  Modified:    modules/experimental cache_pqueue.c cache_pqueue.h
  Log:
  standardize the syntax here
  
  Revision  Changes    Path
  1.9       +10 -25    httpd-2.0/modules/experimental/cache_pqueue.c
  
  Index: cache_pqueue.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/cache_pqueue.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -d -u -r1.8 -r1.9
  --- cache_pqueue.c	13 Aug 2002 23:49:26 -0000	1.8
  +++ cache_pqueue.c	14 Aug 2002 00:07:44 -0000	1.9
  @@ -81,14 +81,14 @@
       apr_ssize_t size;
       apr_ssize_t avail;
       apr_ssize_t step;
  -    cache_pqueue_get_priority* pri;
  -    cache_pqueue_getpos* get;
  -    cache_pqueue_setpos* set;
  +    cache_pqueue_get_priority pri;
  +    cache_pqueue_getpos get;
  +    cache_pqueue_setpos set;
       void **d;
   };
   
   cache_pqueue_t *cache_pq_init(apr_ssize_t n,
  -                              cache_pqueue_get_priority* pri,
  +                              cache_pqueue_get_priority pri,
                                 cache_pqueue_getpos get,
                                 cache_pqueue_setpos set)
   {
  @@ -250,31 +250,16 @@
   
   void *cache_pq_pop(cache_pqueue_t *q)
   {
  -    void *tmp;
  -    void *d;
  -    int i = 1;
  -    int j;
  +    void *head;
   
       if (!q || q->size == 1)
           return NULL;
   
  -    d = q->d[1];
  -    tmp = q->d[--q->size];
  -    while (i <= q->size / 2) {
  -        j = 2 * i;
  -        if (j < q->size && q->pri(q->d[j]) < q->pri(q->d[j
+ 1])) {
  -            j++;
  -        }
  -        if (q->pri(q->d[j]) <= q->pri(tmp)) {
  -            break;
  -        }
  -        q->d[i] = q->d[j];
  -        q->set(q->d[i], i);
  -        i = j;
  -    }
  -    q->d[i] = tmp;
  -    q->set(q->d[i], i);
  -    return d;
  +    head = q->d[1];
  +    q->d[1] = q->d[--q->size];
  +    cache_pq_percolate_down(q, 1);
  +
  +    return head;
   }
   
   void *cache_pq_peek(cache_pqueue_t *q)
  
  
  
  1.4       +6 -6      httpd-2.0/modules/experimental/cache_pqueue.h
  
  Index: cache_pqueue.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/cache_pqueue.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -d -u -r1.3 -r1.4
  --- cache_pqueue.h	13 Aug 2002 23:47:50 -0000	1.3
  +++ cache_pqueue.h	14 Aug 2002 00:07:44 -0000	1.4
  @@ -78,21 +78,21 @@
    * @param a the element
    * @return  the score (the lower the score the longer it is kept int the queue)
    */
  -typedef long cache_pqueue_set_priority(long queue_clock, void*a);
  -typedef long cache_pqueue_get_priority(void*a);
  +typedef long (*cache_pqueue_set_priority)(long queue_clock, void *a);
  +typedef long (*cache_pqueue_get_priority)(void *a);
   
   /** callback function to get a position of a element */
  -typedef apr_ssize_t cache_pqueue_getpos(void *a);
  +typedef apr_ssize_t (*cache_pqueue_getpos)(void *a);
   
   /**
    * callback function to set a position of a element
    * @param a   the element
    * @param pos the position to set it to
    */
  -typedef void cache_pqueue_setpos(void *a, apr_ssize_t pos);
  +typedef void (*cache_pqueue_setpos)(void *a, apr_ssize_t pos);
   
   /** debug callback function to print a entry */
  -typedef void cache_pqueue_print_entry(FILE *out, void *a);
  +typedef void (*cache_pqueue_print_entry)(FILE *out, void *a);
   
   /**
    * initialize the queue
  @@ -106,7 +106,7 @@
    * @Return the handle or NULL for insufficent memory
    */
   cache_pqueue_t *cache_pq_init(apr_ssize_t n,
  -                              cache_pqueue_get_priority *pri,
  +                              cache_pqueue_get_priority pri,
                                 cache_pqueue_getpos get,
                                 cache_pqueue_setpos set);
   /**
  
  
  

Mime
View raw message