cache_pqueue.c revision f08574f1098defdf1dc7e7f18a1e3664ee157150
0d72955a51d8dbff9564b0983239561cff4bff56Tim Reddehase/* ====================================================================
27caf7f48edaed40a295eaeefbfdeaf9ced10ff9Christian Clausen * The Apache Software License, Version 1.1
4e91a7a04053ace25f8a60fd6e777fd620948176Christian Clausen * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
4e91a7a04053ace25f8a60fd6e777fd620948176Christian Clausen * Redistribution and use in source and binary forms, with or without
4e91a7a04053ace25f8a60fd6e777fd620948176Christian Clausen * modification, are permitted provided that the following conditions
9207b76195d960634cc7bf91a1c9331632fedf29Christian Clausen * 1. Redistributions of source code must retain the above copyright
4e91a7a04053ace25f8a60fd6e777fd620948176Christian Clausen * notice, this list of conditions and the following disclaimer.
9207b76195d960634cc7bf91a1c9331632fedf29Christian Clausen * 2. Redistributions in binary form must reproduce the above copyright
4e91a7a04053ace25f8a60fd6e777fd620948176Christian Clausen * notice, this list of conditions and the following disclaimer in
4e91a7a04053ace25f8a60fd6e777fd620948176Christian Clausen * the documentation and/or other materials provided with the
4e91a7a04053ace25f8a60fd6e777fd620948176Christian Clausen * distribution.
4e91a7a04053ace25f8a60fd6e777fd620948176Christian Clausen * 3. The end-user documentation included with the redistribution,
27caf7f48edaed40a295eaeefbfdeaf9ced10ff9Christian Clausen * if any, must include the following acknowledgment:
39c4771c707df2e99dd89378a82b21682deb90f5Tim Reddehase * "This product includes software developed by the
39c4771c707df2e99dd89378a82b21682deb90f5Tim Reddehase * Apache Software Foundation (http://www.apache.org/)."
0d72955a51d8dbff9564b0983239561cff4bff56Tim Reddehase * Alternately, this acknowledgment may appear in the software itself,
39c4771c707df2e99dd89378a82b21682deb90f5Tim Reddehase * if and wherever such third-party acknowledgments normally appear.
76e1d31005569988e6b629f10350fac7c10d181aTim Reddehase * 4. The names "Apache" and "Apache Software Foundation" must
76e1d31005569988e6b629f10350fac7c10d181aTim Reddehase * not be used to endorse or promote products derived from this
76e1d31005569988e6b629f10350fac7c10d181aTim Reddehase * software without prior written permission. For written
0d72955a51d8dbff9564b0983239561cff4bff56Tim Reddehase * permission, please contact apache@apache.org.
0d72955a51d8dbff9564b0983239561cff4bff56Tim Reddehase * 5. Products derived from this software may not be called "Apache",
9207b76195d960634cc7bf91a1c9331632fedf29Christian Clausen * nor may "Apache" appear in their name, without prior written
3af118695056ef1eba8d1980768c64631744a198Tim Reddehase * permission of the Apache Software Foundation.
#include "apr_general.h"
#include <stdlib.h>
#if APR_HAVE_STDIO_H
#include <stdio.h>
#include <string.h>
#include "cache_pqueue.h"
struct cache_pqueue_t
cache_pqueue_t *q;
return NULL;
free(q);
return NULL;
free(q->d);
free(q);
void *moving_node = q->d[i];
q->d[i] = q->d[parent_node];
q->set(q->d[i], i);
q->d[i] = moving_node;
return child_node;
void *moving_node = q->d[i];
q->d[i] = q->d[child_node];
q->set(q->d[i], i);
i = child_node;
q->d[i] = moving_node;
void *tmp;
apr_ssize_t i;
if (!q) return APR_EGENERAL;
return APR_EGENERAL;
q->d = tmp;
i = q->size++;
cache_pq_bubble_up(q, i);
return APR_SUCCESS;
long old_priority,
long new_priority,
return APR_SUCCESS;
void *head;
return NULL;
return head;
return NULL;
maxchild(q, i));
void *e = NULL;