![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
Useful functions for application developers. More...
Files | |
| file | audio_loop.h |
| Utility function for playing audio on Linux or MacOS. | |
| file | deque.h |
| Implementation of a double-ended queue. | |
| file | generics.h |
| This file provides macros for Generic Reactors in C-Target. | |
| file | hashmap.h |
| Defines a generic, non-resizing hashmap data type. | |
| file | hashset.h |
| A hash set implementation in C. | |
| file | hashset_itr.h |
| A C hashset iterator implemenation. | |
| file | pointer_hashmap.h |
| Defines a hashmap type that maps void pointers to integers. | |
| file | sensor_simulator.h |
| Simple terminal-based user interface based on ncurses. | |
| file | type_converter.h |
| This file provides macro DO_CONVERT(fromType, toType, value). | |
| file | wave_file_reader.h |
| Utility function for reading WAV audio files. | |
Data Structures | |
| struct | deque_t |
| A double-ended queue data structure. More... | |
| struct | hashmap_entry_t |
| A hashmap entry. More... | |
| struct | hashmap_t |
| A hashmap. More... | |
| struct | hashset_itr_st |
| A hashset iterator. More... | |
| struct | hashset_st |
| A hashset. More... | |
| struct | lf_waveform_t |
| Waveform in 16-bit linear-PCM format. More... | |
| struct | vector_t |
| A vector (resizing array) data type. More... | |
Macros | |
| #define | AUDIO_BUFFER_SIZE 4410 |
| Size of the audio buffer. | |
| #define | BUFFER_DURATION_NS 100000000LL |
| Duration of the audio buffer. | |
| #define | DO_CONVERT(fromType, toType, value) |
| Convert the specified value from one type to another. | |
| #define | lf_decay(p) |
| Decay the specified pointer. | |
| #define | lf_get_pointer(p) |
| Return the pointer for specified p. | |
| #define | lf_is_pointer(p) |
| Check whether the passed variable p is a pointer. | |
| #define | lf_is_pointer_or_array(p) |
| Check whether the passed variable p is an array or a pointer. | |
| #define | lf_is_same(typename, b) |
| Check whether the type of b is same as the specified typename. | |
| #define | lf_is_same_type(a, b) |
| Check whether the types of both a and b are same. | |
| #define | lf_is_type_equal(typename_a, typename_b) |
| Check whether the type of typename_a is same as the type of typename_b. | |
| #define | lf_to_left_type(left, right) |
| Check types for both left and right and return appropriate value based on left type. | |
| #define | MAX_AMPLITUDE 32765 |
| Maximum amplitude for audio playback. | |
| #define | NUM_CHANNELS 1 |
| Number of channels for audio playback. | |
| #define | NUM_NOTES 8 |
| Maximum number of notes that can play simultaneously. | |
| #define | SAMPLE_RATE 44100 |
| Sample rate for audio playback. | |
Typedefs | |
| typedef struct deque_t | deque_t |
| A double-ended queue data structure. | |
| typedef struct hashmap_entry_t | hashmap_entry_t |
| A hashmap entry. | |
| typedef struct hashmap_t | hashmap_t |
| A hashmap. | |
| typedef struct lf_waveform_t | lf_waveform_t |
| Waveform in 16-bit linear-PCM format. | |
| typedef struct vector_t | vector_t |
| A vector (resizing array) data type. | |
Functions | |
| void | add_to_sound (int index_offset, double value) |
| Add the given value to the current write buffer at the specified index. | |
| void | deque_initialize (deque_t *d) |
| Initialize the specified deque to an empty deque. | |
| bool | deque_is_empty (deque_t *d) |
| Return true if the queue is empty. | |
| void * | deque_peek_back (deque_t *d) |
| Peek at the value on the front of the queue, leaving it on the queue. | |
| void * | deque_peek_front (deque_t *d) |
| Peek at the value on the back of the queue, leaving it on the queue. | |
| void * | deque_pop_back (deque_t *d) |
| Pop a value from the back of the queue, removing it from the queue. | |
| void * | deque_pop_front (deque_t *d) |
| Pop a value from the front of the queue, removing it from the queue. | |
| void | deque_push_back (deque_t *d, void *value) |
| Push a value to the back of the queue. | |
| void | deque_push_front (deque_t *d, void *value) |
| Push a value to the front of the queue. | |
| size_t | deque_size (deque_t *d) |
| Return the size of the queue. | |
| void | end_sensor_simulator () |
| End ncurses control of the terminal. | |
| void | hashmap_free (hashmap_t *hashmap) |
| Free all memory used by the given hashmap. | |
| void * | hashmap_get (hashmap_t *hashmap, void *key) |
| Get the value associated with the given key. | |
| static hashmap_entry_t * | hashmap_get_actual_address (hashmap_t *hashmap, void *key) |
| Return the actual address of the hashmap entry corresponding to key, or the address of the closest empty entry if no such entry exists. | |
| hashmap_t * | hashmap_new (size_t capacity, void *nothing) |
| Construct a new hashmap object. | |
| void | hashmap_put (hashmap_t *hashmap, void *key, void *value) |
| Associate a value with the given key. | |
| int | hashset_add (hashset_t set, void *item) |
| Add a pointer to the hashset. | |
| hashset_t | hashset_create (unsigned short nbits) |
| Create a hashset instance. | |
| void | hashset_destroy (hashset_t set) |
| Destroy the hashset instance, freeing allocated memory. | |
| int | hashset_is_member (hashset_t set, void *item) |
| Returns non-zero if the item is in the hashset and zero otherwise. | |
| hashset_itr_t | hashset_iterator (hashset_t set) |
| Create a hashset iterator. | |
| int | hashset_iterator_has_next (hashset_itr_t itr) |
| Return 1 if there is a next value in the hashset and 0 otherwise. | |
| int | hashset_iterator_next (hashset_itr_t itr) |
| Advance to the next value in the hashset. | |
| void * | hashset_iterator_value (hashset_itr_t itr) |
| Return the value at the current index. | |
| size_t | hashset_num_items (hashset_t set) |
| Return the number of items in the hashset. | |
| int | hashset_remove (hashset_t set, void *item) |
| Remove an item from the hashset. | |
| int | lf_play_audio_waveform (lf_waveform_t *waveform, float emphasis, instant_t start_time) |
| Play the specified waveform with the specified emphasis at the specified time. | |
| void | lf_start_audio_loop (instant_t start_time) |
| Start an audio loop thread that becomes ready to receive audio amplitude samples via add_to_sound(). | |
| void | lf_stop_audio_loop () |
| Stop the audio loop thread. | |
| lf_waveform_t * | read_wave_file (const char *path) |
| Open a wave file, check that the format is supported, allocate memory for the sample data, and fill the memory with the sample data. | |
| int | register_sensor_key (char key, void *action) |
| Register a keyboard key to trigger the specified action. | |
| void | show_tick (const char *character) |
| Place a tick (usually a single character) in the tick window. | |
| int | start_sensor_simulator (const char *message_lines[], int number_of_lines, int tick_window_width, char *log_file, int log_level) |
| Start the sensor simulator if it has not been already started. | |
| void ** | vector_at (vector_t *v, size_t idx) |
| Return a pointer to where the vector element at 'idx' is stored. | |
| void | vector_free (vector_t *v) |
| Free the memory held by the given vector, invalidating it. | |
| vector_t | vector_new (size_t initial_capacity) |
| Allocate and initialize a new vector. | |
| void * | vector_pop (vector_t *v) |
| Remove and return some pointer that is contained in the given vector, or return NULL if the given vector is empty. | |
| void | vector_push (vector_t *v, void *element) |
| Add the given element to the vector. | |
| void | vector_pushall (vector_t *v, void **array, size_t size) |
| Add all elements of the given array to the vector. | |
| size_t | vector_size (vector_t *v) |
| Return the size of the vector. | |
| void | vector_vote (vector_t *v) |
| Vote on whether this vector should be given less memory. | |
Useful functions for application developers.
This collection of functions provides commonly used functionality that is not part of the core API.
| #define AUDIO_BUFFER_SIZE 4410 |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Size of the audio buffer.
| #define BUFFER_DURATION_NS 100000000LL |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Duration of the audio buffer.
| #define DO_CONVERT | ( | fromType, | |
| toType, | |||
| value ) |
#include </Users/runner/work/reactor-c/reactor-c/util/type_converter.h>
Convert the specified value from one type to another.
This macro enables user to provide their own converter libraries as long as they follow the convention for naming their conversion functions.
| fromType | Typename of value field |
| toType | Typename of desired type |
| value | Actual value of type fromType |
| #define lf_decay | ( | p | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/generics.h>
Decay the specified pointer.
| p | The pointer to decay. |
| #define lf_get_pointer | ( | p | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/generics.h>
Return the pointer for specified p.
| p | The variable to get the pointer for. |
| #define lf_is_pointer | ( | p | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/generics.h>
Check whether the passed variable p is a pointer.
| p | The variable to check. |
| #define lf_is_pointer_or_array | ( | p | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/generics.h>
Check whether the passed variable p is an array or a pointer.
| p | The variable to check. |
| #define lf_is_same | ( | typename, | |
| b ) |
#include </Users/runner/work/reactor-c/reactor-c/util/generics.h>
Check whether the type of b is same as the specified typename.
| typename | The type to compare against. |
| b | The value to compare. |
| #define lf_is_same_type | ( | a, | |
| b ) |
#include </Users/runner/work/reactor-c/reactor-c/util/generics.h>
Check whether the types of both a and b are same.
| a | The first value to compare. |
| b | The second value to compare. |
| #define lf_is_type_equal | ( | typename_a, | |
| typename_b ) |
#include </Users/runner/work/reactor-c/reactor-c/util/generics.h>
Check whether the type of typename_a is same as the type of typename_b.
| typename_a | The first type to compare against. |
| typename_b | The second type to compare against. |
| #define lf_to_left_type | ( | left, | |
| right ) |
#include </Users/runner/work/reactor-c/reactor-c/util/generics.h>
Check types for both left and right and return appropriate value based on left type.
| left | The left value to check. |
| right | The right value to check. |
| #define MAX_AMPLITUDE 32765 |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Maximum amplitude for audio playback.
| #define NUM_CHANNELS 1 |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Number of channels for audio playback.
| #define NUM_NOTES 8 |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Maximum number of notes that can play simultaneously.
| #define SAMPLE_RATE 44100 |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Sample rate for audio playback.
| typedef struct deque_t deque_t |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
A double-ended queue data structure.
| typedef struct hashmap_entry_t hashmap_entry_t |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/impl/hashmap.h>
A hashmap entry.
| typedef struct hashmap_t hashmap_t |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/impl/hashmap.h>
A hashmap.
| typedef struct lf_waveform_t lf_waveform_t |
#include </Users/runner/work/reactor-c/reactor-c/util/wave_file_reader.h>
Waveform in 16-bit linear-PCM format.
The waveform element is an array containing audio samples. If there are two channels, then they are interleaved left and right channel. The length is the total number of samples, a multiple of the number of channels.
| typedef struct vector_t vector_t |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
A vector (resizing array) data type.
This struct implements a dynamic array that can grow as needed. It is designed to be a simple way of storing a collection of pointers that is frequently filled and then completely emptied.
| void add_to_sound | ( | int | index_offset, |
| double | value ) |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Add the given value to the current write buffer at the specified index.
If the resulting value is larger than what can be represented in the 16-bit short, truncate it.
| index_offset | Where in the buffer to add the amplitude. |
| value | The amplitude to add to whatever amplitude is already there. |
| void deque_initialize | ( | deque_t * | d | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Initialize the specified deque to an empty deque.
| d | The deque. |
| bool deque_is_empty | ( | deque_t * | d | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Return true if the queue is empty.
| d | The deque. |
| void * deque_peek_back | ( | deque_t * | d | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Peek at the value on the front of the queue, leaving it on the queue.
| d | The queue. |
| void * deque_peek_front | ( | deque_t * | d | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Peek at the value on the back of the queue, leaving it on the queue.
| d | The queue. |
| void * deque_pop_back | ( | deque_t * | d | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Pop a value from the back of the queue, removing it from the queue.
| d | The queue. |
| void * deque_pop_front | ( | deque_t * | d | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Pop a value from the front of the queue, removing it from the queue.
| d | The queue. |
| void deque_push_back | ( | deque_t * | d, |
| void * | value ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Push a value to the back of the queue.
| d | The queue. |
| value | The value to push. |
| void deque_push_front | ( | deque_t * | d, |
| void * | value ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Push a value to the front of the queue.
| d | The queue. |
| value | The value to push. |
| size_t deque_size | ( | deque_t * | d | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/deque.h>
Return the size of the queue.
| d | The deque. |
| void end_sensor_simulator | ( | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/sensor_simulator.h>
End ncurses control of the terminal.
| void hashmap_free | ( | hashmap_t * | hashmap | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/impl/hashmap.h>
Free all memory used by the given hashmap.
| void * hashmap_get | ( | hashmap_t * | hashmap, |
| void * | key ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/impl/hashmap.h>
Get the value associated with the given key.
Precondition: The key must be present in the map.
|
static |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/impl/hashmap.h>
Return the actual address of the hashmap entry corresponding to key, or the address of the closest empty entry if no such entry exists.
| hashmap | The hashmap to search. |
| key | The key from which to begin a search. |
| hashmap_t * hashmap_new | ( | size_t | capacity, |
| void * | nothing ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/impl/hashmap.h>
Construct a new hashmap object.
| capacity | A number that is much larger than the maximum number of items that this hashmap will contain. Insufficient surplus capacity will cause poor performance. |
| nothing | A key that is guaranteed never to be used. |
| void hashmap_put | ( | hashmap_t * | hashmap, |
| void * | key, | ||
| void * | value ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/impl/hashmap.h>
Associate a value with the given key.
| int hashset_add | ( | hashset_t | set, |
| void * | item ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset.h>
Add a pointer to the hashset.
Note that 0 and 1 are special values, meaning nil and deleted items. This function will return -1 indicating error if you try to add 0 or 1. This function may resize the hashset if it is approaching capacity. Returns zero if the item is already in the set and non-zero otherwise.
| set | The hashset. |
| item | The item to add. |
| hashset_t hashset_create | ( | unsigned short | nbits | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset.h>
Create a hashset instance.
The returned value is a pointer. The caller must call hashset_destroy() to free allocated memory.
| nbits | The log base 2 of the initial capacity of the hashset. |
| void hashset_destroy | ( | hashset_t | set | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset.h>
Destroy the hashset instance, freeing allocated memory.
| set | The hashset to destroy. |
| int hashset_is_member | ( | hashset_t | set, |
| void * | item ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset.h>
Returns non-zero if the item is in the hashset and zero otherwise.
| set | The hashset. |
| item | The item to check. |
| hashset_itr_t hashset_iterator | ( | hashset_t | set | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset_itr.h>
Create a hashset iterator.
The caller should then iterate over the hashset as follows:
The caller must call free() on this iterator after using it.
| set | The hashset to iterate over. |
| int hashset_iterator_has_next | ( | hashset_itr_t | itr | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset_itr.h>
Return 1 if there is a next value in the hashset and 0 otherwise.
| itr | The hashset iterator. |
| int hashset_iterator_next | ( | hashset_itr_t | itr | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset_itr.h>
Advance to the next value in the hashset.
This returns a non-negative number (the current index) if there is a next item and -1 otherwise.
| itr | The hashset iterator. |
| void * hashset_iterator_value | ( | hashset_itr_t | itr | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset_itr.h>
Return the value at the current index.
The called should check hashset_iterator_has_next before calling this.
| itr | The hashset iterator. |
| size_t hashset_num_items | ( | hashset_t | set | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset.h>
Return the number of items in the hashset.
| set | The hashset. |
| int hashset_remove | ( | hashset_t | set, |
| void * | item ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/hashset/hashset.h>
Remove an item from the hashset.
| set | The hashset. |
| item | The item to remove. |
| int lf_play_audio_waveform | ( | lf_waveform_t * | waveform, |
| float | emphasis, | ||
| instant_t | start_time ) |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Play the specified waveform with the specified emphasis at the specified time.
If the waveform is null, play a simple tick (an impulse). If the waveform has length zero or volume 0, play nothing.
If the time is too far in the future (beyond the window of the current audio write buffer), then block until the audio output catches up. If the audio playback has already passed the specified point, then play the waveform as soon as possible and return 1. Otherwise, return 0.
| waveform | The waveform to play or NULL to just play a tick. |
| emphasis | The emphasis (0.0 for silence, 1.0 for waveform volume). |
| start_time | The time to start playing the waveform. |
| void lf_start_audio_loop | ( | instant_t | start_time | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Start an audio loop thread that becomes ready to receive audio amplitude samples via add_to_sound().
If there is already an audio loop running, then do nothing.
| start_time | The logical time that aligns with the first audio buffer. |
| void lf_stop_audio_loop | ( | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/audio_loop.h>
Stop the audio loop thread.
| lf_waveform_t * read_wave_file | ( | const char * | path | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/wave_file_reader.h>
Open a wave file, check that the format is supported, allocate memory for the sample data, and fill the memory with the sample data.
It is up to the caller to free the memory when done with it. That code should first free the waveform element of the returned struct, then the struct itself. This implementation supports only 16-bit linear PCM files. On a Mac, you can convert audio files into this format using the afconvert utility.
| path | The path to the file. |
| int register_sensor_key | ( | char | key, |
| void * | action ) |
#include </Users/runner/work/reactor-c/reactor-c/util/sensor_simulator.h>
Register a keyboard key to trigger the specified action.
Printable ASCII characters (codes 32 to 127) are supported plus '
' and '\0', where the latter registers a trigger to invoked when any key is pressed. If a specific key is registered and any key ('\0') is also registered, the registered and any key ('\0') is also registered, the any key trigger will be scheduled after the specific key is scheduled. If these triggers belong to different reactors, they could be invoked in parallel. This will fail if the specified key has already been registered (error code 1), or the key is not a supported key or a newline ‘
’ or any key '\0' (error code 2) or if the trigger is NULL (error code 3).
| key | The key to register. |
| action | The action to trigger when the key is pressed (a pointer to an lf_action_based_t struct). |
| void show_tick | ( | const char * | character | ) |
#include </Users/runner/work/reactor-c/reactor-c/util/sensor_simulator.h>
Place a tick (usually a single character) in the tick window.
| character | The tick character. |
| int start_sensor_simulator | ( | const char * | message_lines[], |
| int | number_of_lines, | ||
| int | tick_window_width, | ||
| char * | log_file, | ||
| int | log_level ) |
#include </Users/runner/work/reactor-c/reactor-c/util/sensor_simulator.h>
Start the sensor simulator if it has not been already started.
This must be called at least once before any call to register_sensor_key. The specified message is an initial message to display at the upper left, typically a set of instructions, that remains displayed throughout the lifetime of the window. Please ensure that the message_lines array and its contained strings are not on the stack because they will be used later in a separate thread.
| message_lines | The message lines. |
| number_of_lines | The number of lines. |
| tick_window_width | The width of the tick window or 0 for none. |
| log_file | If non-NULL, the name of a file to which to write logging messages. |
| log_level | The level of log messages to redirect to the file. The level should be one of LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_INFO, LOG_LEVEL_LOG, LOG_LEVEL_DEBUG, or LOG_LEVEL_ALL. |
| void ** vector_at | ( | vector_t * | v, |
| size_t | idx ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
Return a pointer to where the vector element at 'idx' is stored.
This can be used to set the value of the element or to read it. If the index is past the end of the vector, then the vector is automatically expanded and filled with NULL pointers as needed. If no element at idx has been previously set, then the value pointed to by the returned pointer will be NULL.
| v | The vector. |
| idx | The index into the vector. |
| void vector_free | ( | vector_t * | v | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
Free the memory held by the given vector, invalidating it.
| v | Any vector. |
| vector_t vector_new | ( | size_t | initial_capacity | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
Allocate and initialize a new vector.
| initial_capacity | The desired initial capacity to allocate. Must be more than 0. |
| void * vector_pop | ( | vector_t * | v | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
Remove and return some pointer that is contained in the given vector, or return NULL if the given vector is empty.
| v | Any vector. |
| void vector_push | ( | vector_t * | v, |
| void * | element ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
Add the given element to the vector.
The given element should be non-null.
| v | A vector that is to grow. |
| element | An element that the vector should contain. |
| void vector_pushall | ( | vector_t * | v, |
| void ** | array, | ||
| size_t | size ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
Add all elements of the given array to the vector.
Elements should be non-null.
| v | A vector that is to grow. |
| array | An array of items to be added to the vector. |
| size | The size of the given array. |
| size_t vector_size | ( | vector_t * | v | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
Return the size of the vector.
| v | Any vector |
| void vector_vote | ( | vector_t * | v | ) |
#include </Users/runner/work/reactor-c/reactor-c/include/core/utils/vector.h>
Vote on whether this vector should be given less memory.
If v contains few elements, it becomes more likely to shrink. It is suggested that this function be called when the number of elements in v reaches a local maximum.
| v | Any vector. |