Files
Containers/src/priority_queue.h
Bailey Thompson c51bdfefef Remove leading underscore from some identifiers
From the C standard, section 7.1.3:
 - All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.
 - All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces.

The internal struct which defines each container used to start with an underscore followed by a lower case letter. The leading underscore for those identifiers have been replaced in order to prevent undefined behaviour.
2018-01-11 20:01:08 -05:00

53 lines
1.9 KiB
C

/*
* Copyright (c) 2017-2018 Bailey Thompson
*
* 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 CONTAINERS_PRIORITY_QUEUE_H
#define CONTAINERS_PRIORITY_QUEUE_H
#include <stdbool.h>
typedef struct internal_priority_queue *priority_queue;
// Starting
priority_queue priority_queue_init(size_t data_size,
int (*comparator)(const void *const one,
const void *const two));
// Utility
int priority_queue_size(priority_queue me);
bool priority_queue_is_empty(priority_queue me);
// Adding
int priority_queue_push(priority_queue me, void *data);
// Removing
bool priority_queue_pop(void *data, priority_queue me);
// Getting
bool priority_queue_front(void *data, priority_queue me);
// Ending
int priority_queue_clear(priority_queue me);
priority_queue priority_queue_destroy(priority_queue me);
#endif /* CONTAINERS_PRIORITY_QUEUE_H */