Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/bind9/isc
File: heap.h
/*
[0] Fix | Delete
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
[1] Fix | Delete
*
[2] Fix | Delete
* This Source Code Form is subject to the terms of the Mozilla Public
[3] Fix | Delete
* License, v. 2.0. If a copy of the MPL was not distributed with this
[4] Fix | Delete
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
[5] Fix | Delete
*
[6] Fix | Delete
* See the COPYRIGHT file distributed with this work for additional
[7] Fix | Delete
* information regarding copyright ownership.
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
[11] Fix | Delete
#ifndef ISC_HEAP_H
[12] Fix | Delete
#define ISC_HEAP_H 1
[13] Fix | Delete
[14] Fix | Delete
/*! \file isc/heap.h */
[15] Fix | Delete
[16] Fix | Delete
#include <stdbool.h>
[17] Fix | Delete
[18] Fix | Delete
#include <isc/lang.h>
[19] Fix | Delete
#include <isc/types.h>
[20] Fix | Delete
[21] Fix | Delete
ISC_LANG_BEGINDECLS
[22] Fix | Delete
[23] Fix | Delete
/*%
[24] Fix | Delete
* The comparison function returns true if the first argument has
[25] Fix | Delete
* higher priority than the second argument, and false otherwise.
[26] Fix | Delete
*/
[27] Fix | Delete
typedef bool (*isc_heapcompare_t)(void *, void *);
[28] Fix | Delete
[29] Fix | Delete
/*%
[30] Fix | Delete
* The index function allows the client of the heap to receive a callback
[31] Fix | Delete
* when an item's index number changes. This allows it to maintain
[32] Fix | Delete
* sync with its external state, but still delete itself, since deletions
[33] Fix | Delete
* from the heap require the index be provided.
[34] Fix | Delete
*/
[35] Fix | Delete
typedef void (*isc_heapindex_t)(void *, unsigned int);
[36] Fix | Delete
[37] Fix | Delete
/*%
[38] Fix | Delete
* The heapaction function is used when iterating over the heap.
[39] Fix | Delete
*
[40] Fix | Delete
* NOTE: The heap structure CANNOT BE MODIFIED during the call to
[41] Fix | Delete
* isc_heap_foreach().
[42] Fix | Delete
*/
[43] Fix | Delete
typedef void (*isc_heapaction_t)(void *, void *);
[44] Fix | Delete
[45] Fix | Delete
typedef struct isc_heap isc_heap_t;
[46] Fix | Delete
[47] Fix | Delete
isc_result_t
[48] Fix | Delete
isc_heap_create(isc_mem_t *mctx, isc_heapcompare_t compare,
[49] Fix | Delete
isc_heapindex_t index, unsigned int size_increment,
[50] Fix | Delete
isc_heap_t **heapp);
[51] Fix | Delete
/*!<
[52] Fix | Delete
* \brief Create a new heap. The heap is implemented using a space-efficient
[53] Fix | Delete
* storage method. When the heap elements are deleted space is not freed
[54] Fix | Delete
* but will be reused when new elements are inserted.
[55] Fix | Delete
*
[56] Fix | Delete
* Heap elements are indexed from 1.
[57] Fix | Delete
*
[58] Fix | Delete
* Requires:
[59] Fix | Delete
*\li "mctx" is valid.
[60] Fix | Delete
*\li "compare" is a function which takes two void * arguments and
[61] Fix | Delete
* returns true if the first argument has a higher priority than
[62] Fix | Delete
* the second, and false otherwise.
[63] Fix | Delete
*\li "index" is a function which takes a void *, and an unsigned int
[64] Fix | Delete
* argument. This function will be called whenever an element's
[65] Fix | Delete
* index value changes, so it may continue to delete itself from the
[66] Fix | Delete
* heap. This option may be NULL if this functionality is unneeded.
[67] Fix | Delete
*\li "size_increment" is a hint about how large the heap should grow
[68] Fix | Delete
* when resizing is needed. If this is 0, a default size will be
[69] Fix | Delete
* used, which is currently 1024, allowing space for an additional 1024
[70] Fix | Delete
* heap elements to be inserted before adding more space.
[71] Fix | Delete
*\li "heapp" is not NULL, and "*heap" is NULL.
[72] Fix | Delete
*
[73] Fix | Delete
* Returns:
[74] Fix | Delete
*\li ISC_R_SUCCESS - success
[75] Fix | Delete
*\li ISC_R_NOMEMORY - insufficient memory
[76] Fix | Delete
*/
[77] Fix | Delete
[78] Fix | Delete
void
[79] Fix | Delete
isc_heap_destroy(isc_heap_t **heapp);
[80] Fix | Delete
/*!<
[81] Fix | Delete
* \brief Destroys a heap.
[82] Fix | Delete
*
[83] Fix | Delete
* Requires:
[84] Fix | Delete
*\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t.
[85] Fix | Delete
*/
[86] Fix | Delete
[87] Fix | Delete
isc_result_t
[88] Fix | Delete
isc_heap_insert(isc_heap_t *heap, void *elt);
[89] Fix | Delete
/*!<
[90] Fix | Delete
* \brief Inserts a new element into a heap.
[91] Fix | Delete
*
[92] Fix | Delete
* Requires:
[93] Fix | Delete
*\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t.
[94] Fix | Delete
*/
[95] Fix | Delete
[96] Fix | Delete
void
[97] Fix | Delete
isc_heap_delete(isc_heap_t *heap, unsigned int index);
[98] Fix | Delete
/*!<
[99] Fix | Delete
* \brief Deletes an element from a heap, by element index.
[100] Fix | Delete
*
[101] Fix | Delete
* Requires:
[102] Fix | Delete
*\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t.
[103] Fix | Delete
*\li "index" is a valid element index, as provided by the "index" callback
[104] Fix | Delete
* provided during heap creation.
[105] Fix | Delete
*/
[106] Fix | Delete
[107] Fix | Delete
void
[108] Fix | Delete
isc_heap_increased(isc_heap_t *heap, unsigned int index);
[109] Fix | Delete
/*!<
[110] Fix | Delete
* \brief Indicates to the heap that an element's priority has increased.
[111] Fix | Delete
* This function MUST be called whenever an element has increased in priority.
[112] Fix | Delete
*
[113] Fix | Delete
* Requires:
[114] Fix | Delete
*\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t.
[115] Fix | Delete
*\li "index" is a valid element index, as provided by the "index" callback
[116] Fix | Delete
* provided during heap creation.
[117] Fix | Delete
*/
[118] Fix | Delete
[119] Fix | Delete
void
[120] Fix | Delete
isc_heap_decreased(isc_heap_t *heap, unsigned int index);
[121] Fix | Delete
/*!<
[122] Fix | Delete
* \brief Indicates to the heap that an element's priority has decreased.
[123] Fix | Delete
* This function MUST be called whenever an element has decreased in priority.
[124] Fix | Delete
*
[125] Fix | Delete
* Requires:
[126] Fix | Delete
*\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t.
[127] Fix | Delete
*\li "index" is a valid element index, as provided by the "index" callback
[128] Fix | Delete
* provided during heap creation.
[129] Fix | Delete
*/
[130] Fix | Delete
[131] Fix | Delete
void *
[132] Fix | Delete
isc_heap_element(isc_heap_t *heap, unsigned int index);
[133] Fix | Delete
/*!<
[134] Fix | Delete
* \brief Returns the element for a specific element index.
[135] Fix | Delete
*
[136] Fix | Delete
* Requires:
[137] Fix | Delete
*\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t.
[138] Fix | Delete
*\li "index" is a valid element index, as provided by the "index" callback
[139] Fix | Delete
* provided during heap creation.
[140] Fix | Delete
*
[141] Fix | Delete
* Returns:
[142] Fix | Delete
*\li A pointer to the element for the element index.
[143] Fix | Delete
*/
[144] Fix | Delete
[145] Fix | Delete
void
[146] Fix | Delete
isc_heap_foreach(isc_heap_t *heap, isc_heapaction_t action, void *uap);
[147] Fix | Delete
/*!<
[148] Fix | Delete
* \brief Iterate over the heap, calling an action for each element. The
[149] Fix | Delete
* order of iteration is not sorted.
[150] Fix | Delete
*
[151] Fix | Delete
* Requires:
[152] Fix | Delete
*\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t.
[153] Fix | Delete
*\li "action" is not NULL, and is a function which takes two arguments.
[154] Fix | Delete
* The first is a void *, representing the element, and the second is
[155] Fix | Delete
* "uap" as provided to isc_heap_foreach.
[156] Fix | Delete
*\li "uap" is a caller-provided argument, and may be NULL.
[157] Fix | Delete
*
[158] Fix | Delete
* Note:
[159] Fix | Delete
*\li The heap structure CANNOT be modified during this iteration. The only
[160] Fix | Delete
* safe function to call while iterating the heap is isc_heap_element().
[161] Fix | Delete
*/
[162] Fix | Delete
[163] Fix | Delete
ISC_LANG_ENDDECLS
[164] Fix | Delete
[165] Fix | Delete
#endif /* ISC_HEAP_H */
[166] Fix | Delete
[167] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function