* @brief Internal implementation of array_at_checked. * * Returns a pointer to the element at `index`, or NULL when `index` * is out of range. Unlike the raw `array_at` accessor, this performs a * bounds check before computing the address. */
| 99 | * is out of range. Unlike the raw `array_at` accessor, this performs a |
| 100 | * bounds check before computing the address. |
| 101 | */ |
| 102 | /* The lookup helpers take `const void*` (like strchr), so they work on a |
| 103 | const array too (passing its data used to discard the qualifier); the |
| 104 | result must then only be read. */ |
| 105 | static inline void *arrayp_at_checked_impl(const void *data, size_t count, |
| 106 | size_t elem_size, size_t index) { |
| 107 | if (index >= count) { |
| 108 | return NULL; |
| 109 | } |
| 110 | return (unsigned char *)(uintptr_t)data + index * elem_size; |
nothing calls this directly
no outgoing calls
no test coverage detected