/usr/include/guacamole/pool.h is in libguac-dev 0.9.9-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef _GUAC_POOL_H
#define _GUAC_POOL_H
/**
* Provides functions and structures for maintaining dynamically allocated and
* freed pools of integers.
*
* @file pool.h
*/
#include "pool-types.h"
struct guac_pool {
/**
* The minimum number of integers which must have been returned by
* guac_pool_next_int before previously-used and freed integers are
* allowed to be returned.
*/
int min_size;
/**
* The number of integers currently in use.
*/
int active;
/**
* The next integer to be released (after no more integers remain in the
* pool.
*/
int __next_value;
/**
* The first integer in the pool, if any.
*/
guac_pool_int* __head;
/**
* The last integer in the pool, if any.
*/
guac_pool_int* __tail;
};
struct guac_pool_int {
/**
* The integer value of this pool entry.
*/
int value;
/**
* The next available (unused) guac_pool_int in the list of
* allocated but free'd ints.
*/
guac_pool_int* __next;
};
/**
* Allocates a new guac_pool having the given minimum size.
*
* @param size The minimum number of integers which must have been returned by
* guac_pool_next_int before freed integers (previously used
* integers) are allowed to be returned.
* @return A new, empty guac_pool, having the given minimum size.
*/
guac_pool* guac_pool_alloc(int size);
/**
* Frees the given guac_pool.
*
* @param pool The guac_pool to free.
*/
void guac_pool_free(guac_pool* pool);
/**
* Returns the next available integer from the given guac_pool. All integers
* returned are non-negative, and are returned in sequences, starting from 0.
*
* @param pool The guac_pool to retrieve an integer from.
* @return The next available integer, which may be either an integer not yet
* returned by a call to guac_pool_next_int, or an integer which was
* previosly returned, but has since been freed.
*/
int guac_pool_next_int(guac_pool* pool);
/**
* Frees the given integer back into the given guac_pool. The integer given
* will be available for future calls to guac_pool_next_int.
*
* @param pool The guac_pool to free the given integer into.
* @param value The integer which should be returned to the given pool, such
* that it can be received by a future call to guac_pool_next_int.
*/
void guac_pool_free_int(guac_pool* pool, int value);
#endif
|