Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/KaisenAmin/c_std
/ functions
Functions
2,651 in github.com/KaisenAmin/c_std
⨍
Functions
2,651
◇
Types & classes
138
Function
queue_sort
* @brief Sort the queue in-place using @p comp (qsort-style 3-way * comparator). * * After sorting, @ref queue_front returns the smallest el
queue/queue.c:426
Function
queue_swap
* @brief Constant-time swap of two queues' internals. * * Only the underlying vector pointers are swapped — no element-by- * element copy. Rejects
queue/queue.c:387
Function
random_beta
* @brief Generates a random double number based on the Beta distribution. * * @param alpha The shape1 parameter of the distribution (must be greater
random/random.c:774
Function
random_boolean
* @brief Performs a Bernoulli trial: returns `true` with probability @p p and * `false` with probability `1 - p`. * * This is the reproducib
random/random.c:182
Function
random_choice
* @brief Randomly selects an element from an array and returns a pointer to an element from the array. * * @param array Pointer to the array to sele
random/random.c:356
Function
random_choices
* @brief Selects multiple random elements from an array with specified weights. * The selected elements are copied into the provided choices array.
random/random.c:438
Function
random_expo
* @brief Generates a random double number based on the Exponential distribution. * * @param lambda The rate parameter (1/mean) of the distribution (
random/random.c:662
Function
random_getrandbits
* @brief Generates a non-negative random integer with the requested number * of random bits. * * @param a Number of random bits to generate
random/random.c:235
Function
random_getstate
* @brief This function retrieves the current state of the random number generator. * * @param state A pointer to where the current state of the ran
random/random.c:589
Function
random_lognormal
* @brief Generates a random double number based on the Log-normal distribution. * * @param mean The mean parameter of the underlying normal distribu
random/random.c:691
Function
random_pareto
* @brief Generates a random double number based on the Pareto distribution. * which is a continuous probability distribution. * * @param shape The
random/random.c:803
Function
random_randbytes
* @brief Fills @p buffer with @p n pseudo-random bytes from the seeded engine. * * The fast, reproducible counterpart to `secrets_token_bytes` (whic
random/random.c:273
Function
random_randint
* @brief This function generates a random integer in the range [a, b], inclusive. * if `a` is greater than `b`, their values are swapped to ensure th
random/random.c:85
Function
random_randrange
* @brief This function generates a random integer in the range `[a, b)` with a specified step. * * @param a The start of the range (inclusive). * @
random/random.c:113
Function
random_sample
* @brief Samples a specified number of unique random elements from an array. * The sampled elements are copied into the provided samples array. * *
random/random.c:509
Function
random_seed
* @brief This function sets the seed for the random number generator, allowing * for reproducible sequences of random numbers. * * @param seed
random/random.c:62
Function
random_setstate
* @brief This function sets the state of the random number generator to the specified value. * * @param state A pointer to the state value to set t
random/random.c:567
Function
random_shuffle
* @brief Shuffles an array of any type. * @param array Pointer to the array to shuffle. if array is NULL function print error message and return not
random/random.c:312
Function
random_triangular
* @brief Generates a random double number based on the Triangular distribution. * * @param low The lower limit of the distribution. * @param high T
random/random.c:390
Function
random_vonmises
* @brief Generates a random double number based on the von Mises distribution. * which is a continuous probability distribution on the circle. * *
random/random.c:865
Function
random_weibull
* @brief Generates a random double number based on the Weibull distribution. * which is a continuous probability distribution. * * @param shape The
random/random.c:834
Function
regex_count_matches
* @brief Counts every non-overlapping occurrence of @p pattern in @p string. * * Zero-length matches (e.g. `\b`, `^$`) are handled by advancing one
regex/std_regex.c:475
Function
regex_error_message
* @brief Converts a regex result code to a human-readable error message. * * @param result The result code (e.g., REGEX_COMPILE_ERROR, REGEX_MATCH_
regex/std_regex.c:408
Function
regex_find_all
* @brief Finds all occurrences of the regex pattern in the string. * * @param regex The compiled regex object. * @param string The string to searc
regex/std_regex.c:324
Function
regex_full_match
* @brief Returns 1 if @p pattern matches the ENTIRE @p string, 0 if it does * not, and -1 on compile / NULL-arg / OOM error. * * This is the
regex/std_regex.c:542
Function
regex_match_group
* @brief Copies the @p group_index group of @p match into a freshly- * allocated, NUL-terminated C string. * * `group_index == 0` returns th
regex/std_regex.c:1110
Function
regex_replace
* @brief Returns a freshly-allocated copy of @p string with every match * of @p pattern replaced by the literal text @p replacement. * * Bac
regex/std_regex.c:733
Function
regex_replace_first
* @brief Same as @ref regex_replace but replaces only the FIRST match. * * @code * char* out = regex_replace_first("[0-9]+", "abc123def456", "###",
regex/std_regex.c:751
Function
regex_replace_groups
* @brief Like @ref regex_replace (replaces every match), but the replacement * text may contain backreferences to captured groups. * * Where
regex/std_regex.c:854
Function
regex_split
* @brief Splits @p string at every non-empty match of @p pattern. * * The output is a NULL-terminated array of malloc'd C strings (one per * token,
regex/std_regex.c:943
Function
regex_split_free
* @brief Frees the token array returned by @ref regex_split. NULL-safe. * * @param tokens Token array from @ref regex_split. * @param count Number
regex/std_regex.c:1065
Function
regex_test
* @brief Returns 1 if @p string contains at least one match for @p pattern, * 0 if it doesn't, and -1 on compile / NULL-arg error. * * Wraps
regex/std_regex.c:440
Function
registry_destroy
string/std_string.c:68
Function
rwlock_destroy
* @brief Destroy a read-write lock and release its resources. * * The lock must be idle (no thread holding or waiting on it). Safe to call with * N
concurrent/concurrent.c:1987
Function
rwlock_init
* @brief Initialise a read-write lock. * * A read-write lock lets any number of threads hold it for *reading* * simultaneously, but gives a *writer
concurrent/concurrent.c:1796
Function
rwlock_rdlock
* @brief Acquire the lock for reading (shared), blocking until granted. * * Many readers may hold the lock at once. Blocks while a writer holds the
concurrent/concurrent.c:1833
Function
rwlock_tryrdlock
* @brief Try to acquire the lock for reading without blocking. * * @param rw Initialised lock. Must not be NULL. * @return `THREAD_SUCCESS` if the
concurrent/concurrent.c:1860
Function
rwlock_trywrlock
* @brief Try to acquire the lock for writing without blocking. * * @param rw Initialised lock. Must not be NULL. * @return `THREAD_SUCCESS` if excl
concurrent/concurrent.c:1918
Function
rwlock_unlock
* @brief Release the lock (whether held for reading or writing). * * A single `rwlock_unlock` releases whichever mode the calling thread holds — *
concurrent/concurrent.c:1949
Function
rwlock_wrlock
* @brief Acquire the lock for writing (exclusive), blocking until granted. * * Grants exclusive ownership: no other reader or writer holds the lock
concurrent/concurrent.c:1889
Function
secrets_choice
* @brief Select a random element from a sequence (array) using cryptographically secure randomness. * * @param seq Pointer to the sequence (array)
secrets/secrets.c:351
Function
secrets_compare_digest
* @brief Compare two byte sequences in constant time to prevent timing attacks. * * @param a First byte sequence. * @param b Second byte sequence.
secrets/secrets.c:330
Function
secrets_randbelow
* @brief Generate a cryptographically secure random integer in the range [0, n). * * @param n Upper limit (exclusive). * @return A cryptographical
secrets/secrets.c:71
Function
secrets_randbelow_size
* @brief Generate a cryptographically secure, unbiased random size_t in [0, n). * * The size_t-ranged sibling of @ref secrets_randbelow: where that
secrets/secrets.c:131
Function
secrets_randbits
* @brief Generate a non-negative integer with exactly k random bits. * * @param k Number of random bits to generate (must be between 1 and 32). *
secrets/secrets.c:382
Function
secrets_token_from_alphabet
* @brief Generate a random string of @p length characters drawn uniformly * (and without modulo bias) from a caller-supplied @p alphabet. *
secrets/secrets.c:257
Function
secrets_token_hex
* @brief Generate a cryptographically secure random token in hexadecimal format. * * @param buffer Pointer to the array where the token will be sto
secrets/secrets.c:152
Function
secrets_token_urlsafe
* @brief Generate a cryptographically secure random URL-safe token. * * @param buffer A pointer to the array where the token will be stored. * @pa
secrets/secrets.c:189
Function
semaphore_destroy
* @brief Destroy a semaphore and release its OS resources. * * The semaphore must not be in use (no thread blocked in `semaphore_wait`). * Safe to
concurrent/concurrent.c:1771
Function
semaphore_init
* @brief Initialise a counting semaphore with @p initial_count tokens. * * A counting semaphore guards access to a pool of @p initial_count * inter
concurrent/concurrent.c:1656
Function
semaphore_post
* @brief Release a token (the "V"/"post"/"up" operation), waking one waiter. * * - Windows: `ReleaseSemaphore(.., 1, ..)`. * - POSIX: `sem_post
concurrent/concurrent.c:1748
Function
semaphore_trywait
* @brief Try to acquire a token without blocking. * * - Windows: `WaitForSingleObject(0)`. * - POSIX: `sem_trywait`. * * @param sem Initialis
concurrent/concurrent.c:1714
Function
semaphore_wait
* @brief Acquire a token (the "P"/"wait"/"down" operation), blocking until one * is available. * * - Windows: `WaitForSingleObject(INFINITE
concurrent/concurrent.c:1688
Function
serial_bytes_available
* @brief Number of bytes currently waiting in the OS input queue. * * Useful for `serial_read` callers that want to size their read * exactly, or t
serial_port/serial_port.c:745
Function
serial_cleanup
* @brief Pair of serial_init. Returns -1 if never initialised. */
serial_port/serial_port.c:103
Function
serial_close
* @brief Close a port previously opened with serial_open. * * Releases the OS handle and frees the event-callback data (if any). * Safe to call mor
serial_port/serial_port.c:342
Function
serial_configure
* @brief Apply a configuration to an open port. * * @return 0 on success, -1 on bad arg / OS failure / unsupported * baud rate (POSIX only)
serial_port/serial_port.c:423
Function
serial_flush_input
* @brief Discard any data sitting in the input buffer. * * @return 0 on success, -1 on error. */
serial_port/serial_port.c:775
Function
serial_flush_output
* @brief Block until the OS output buffer is empty, then return. * * Useful before closing a port to make sure your last write reaches * the wire.
serial_port/serial_port.c:793
Function
serial_free_ports
* @brief Free the array returned by serial_list_ports. Safe with NULL. */
serial_port/serial_port.c:271
Function
serial_get_config
* @brief Read the port's current configuration into @p config. * * @return 0 on success, -1 on failure. */
serial_port/serial_port.c:526
Function
serial_init
* @brief Initialise the library. Must be called once before any other * serial_* call (other than serial_is_open). * * Returns -1 if already
serial_port/serial_port.c:84
Function
serial_list_ports
* @brief Enumerate every serial port available on the system. * * @param[out] ports On success, set to a newly-allocated array of *
serial_port/serial_port.c:123
Function
serial_open
* @brief Open the named serial port. * * The caller-provided @p port is zero-initialised, then populated with * the OS handle. After this returns s
serial_port/serial_port.c:286
Function
serial_read
* @brief Blocking read of up to @p size bytes into @p buffer. * * @return Bytes read (0 on EOF), or -1 on error. */
serial_port/serial_port.c:612
Function
serial_read_nonblocking
* @brief Non-blocking read: returns 0 immediately when no data is * available rather than blocking. * * Returns -1 only on a hard error; EAG
serial_port/serial_port.c:642
Function
serial_set_event_callback
* @brief Register a callback to be invoked when the port receives a * character or signals an error. * * Windows: spawns a background thread
serial_port/serial_port.c:698
Function
serial_set_timeouts
* @brief Configure read and write timeouts in milliseconds. * * Pass `0` for either value to disable that timeout. On Windows this * uses SetCommTi
serial_port/serial_port.c:813
Function
serial_write
* @brief Write @p size bytes from @p data to the port. * * @return Number of bytes actually written, or -1 on error. */
serial_port/serial_port.c:583
Function
set_cbegin
@brief Const alias of set_begin. */
set/set.c:1057
Function
set_cend
@brief Const alias of set_end. */
set/set.c:1063
Function
set_clear
* @brief Removes all elements, leaving an empty but still-usable set. * * Frees every stored element; the set keeps its element size and comparator
set/set.c:589
Function
set_count
* @brief Counts occurrences of an element (0 or 1, since sets are unique). * @param set The set to search. * @param element The element to look
set/set.c:815
Function
set_crbegin
@brief Const alias of set_rbegin. */
set/set.c:1069
Function
set_crend
@brief Const alias of set_rend. */
set/set.c:1075
Function
set_difference
* @brief Returns a new set of the elements in `a` but not in `b` (`a \ b`). * @param a First operand. @param b Second operand. * @return A new set,
set/set.c:1150
Function
set_elem_size
* @brief Returns the size in bytes of each element the set stores. * @param set The set to query (NULL yields 0). * @return The per-element size, or
set/set.c:639
Function
set_empty
* @brief Reports whether the set contains no elements. * @param set The set to query. * @return true if the set is empty or NULL; false otherwise.
set/set.c:649
Function
set_equal_range
* @brief Returns the range `[lower_bound, upper_bound)` for an element. * * Because sets are unique the range spans at most one element: `first` equ
set/set.c:916
Function
set_erase
* @brief Removes the element equal to `element`, if present. * * Mirrors `std::set::erase(key)`: the matching element (and its owned copy) is * fre
set/set.c:731
Function
set_find
* @brief Finds an element and returns an iterator to it. * @param set The set to search. * @param element The element to look for. * @return An
set/set.c:827
Function
set_intersection
* @brief Returns a new set of the elements present in both `a` and `b`. * * Iterates the smaller operand and probes the larger, so the cost is * O(
set/set.c:1122
Function
set_is_disjoint
* @brief Reports whether `a` and `b` share no elements. * @param a First operand. @param b Second operand. * @return true if the sets are disjoint;
set/set.c:1237
Function
set_is_greater
* @brief Lexicographic greater-than over the sorted elements. * @param set1 Left operand. @param set2 Right operand. * @return true if `set1` > `set
set/set.c:1343
Function
set_is_greater_or_equal
* @brief Lexicographic greater-than-or-equal over the sorted elements. * @param set1 Left operand. @param set2 Right operand. * @return true if `set
set/set.c:1356
Function
set_is_less
* @brief Lexicographic less-than over the sorted elements (like std::set's `<`). * @param set1 Left operand. @param set2 Right operand. * @return tr
set/set.c:1317
Function
set_is_less_or_equal
* @brief Lexicographic less-than-or-equal over the sorted elements. * @param set1 Left operand. @param set2 Right operand. * @return true if `set1`
set/set.c:1330
Function
set_is_not_equal
* @brief Logical negation of set_is_equal (for two non-NULL sets). * @param set1 First set. @param set2 Second set. * @return true if the sets diffe
set/set.c:1304
Function
set_is_superset
* @brief Reports whether every element of `b` is also in `a` (`a ⊇ b`). * @param a Candidate superset. @param b Candidate subset. * @return true if
set/set.c:1227
Function
set_iterator_decrement
* @brief Steps an iterator back to the in-order predecessor. * * Pairs with set_rbegin for reverse traversal. Before the smallest element the * ite
set/set.c:957
Function
set_iterator_equal
* @brief Tests whether two iterators refer to the same position. * @param it1 First iterator (NULL yields false). * @param it2 Second iterator (NULL
set/set.c:978
Function
set_iterator_get
* @brief Returns a read-only pointer to the element at the iterator. * * @param it The iterator to dereference. * @return A `const void*` to the cu
set/set.c:996
Function
set_key_comp
* @brief Returns the comparator the set was created with. * @param set The set to query (NULL yields NULL). * @return The comparator function pointe
set/set.c:1369
Function
set_max_size
* @brief Returns a theoretical upper bound on the number of elements. * * This is `SIZE_MAX / (sizeof(node) + elemSize)` — the count the address spa
set/set.c:663
Function
set_print
* @brief Calls `printElem` on each element in ascending order (debug helper). * @param set The set to print. * @param printElem Callback invok
set/set.c:1391
Function
set_size
* @brief Returns the number of elements stored in the set. * @param set The set to query (NULL yields 0). * @return The element count, or 0 if `set`
set/set.c:629
Function
set_swap
* @brief Exchanges the contents of two sets in constant time. * * Only the internal bookkeeping (root, size, element size, comparator) is * swapped
set/set.c:612
Function
set_symmetric_difference
* @brief Returns a new set of the elements in exactly one of `a` or `b`. * * The symmetric difference `(a \ b) ∪ (b \ a)`. The caller owns the resul
set/set.c:1178
Function
set_union
* @brief Returns a new set containing every element of `a` or `b` (the union). * * The result uses `a`'s comparator and contains deep copies of the
set/set.c:1095
Function
sort_benchmark_algorithms
* @brief Run a fixed suite of sorting algorithms over the same input and * print a per-algorithm timing / comparison / swap table. * * Each
sort/sort.c:2222
← previous
next →
2,001–2,100 of 2,651, ranked by callers