Skip to content

Commit

Permalink
Fix -Wstatic-in-inline issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dr8co committed Apr 6, 2024
1 parent bf335cc commit b2a55e2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lite_str.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ inline void string_free(lite_string *const restrict s) {
*
* @param x The input integer.
* @return The smallest power of 2 greater than or equal to the input integer.
*
* @note This function is for internal use only, and should not be called directly by the user.
*/
__attribute_pure__ static size_t clp2(size_t x) {
__attribute_pure__ inline size_t lite_clp2__(size_t x) {
--x;
x |= x >> 1;
x |= x >> 2;
Expand Down Expand Up @@ -253,7 +255,7 @@ inline bool string_reserve(lite_string *const restrict s, size_t size) {
if (size <= 16) return true;

// Round up the new size to the next power of 2, and reallocate the memory if necessary
size = clp2(size);
size = lite_clp2__(size);
if (size >= s->capacity) {
void *temp = realloc(s->data, size * sizeof(char));
if (temp == nullptr) return false;
Expand Down

0 comments on commit b2a55e2

Please sign in to comment.