refactor: web_utils (#2121)

* chore: move web utils from web, utils to web-utils
This commit is contained in:
Charles Kerr
2021-11-08 21:30:03 -06:00
committed by GitHub
parent 5df3505832
commit d8b57fe4dc
54 changed files with 958 additions and 800 deletions

View File

@@ -30,6 +30,8 @@ struct tr_ptrArray
int n_alloc;
};
using tr_voidptr_compare_func = int (*)(void const* lhs, void const* rhs);
using PtrArrayCompareFunc = tr_voidptr_compare_func;
using PtrArrayForeachFunc = void (*)(void*);
@@ -121,4 +123,13 @@ void tr_ptrArrayRemoveSortedPointer(tr_ptrArray* t, void const* ptr, tr_voidptr_
@return the matching pointer, or nullptr if no match was found */
void* tr_ptrArrayFindSorted(tr_ptrArray* array, void const* key, tr_voidptr_compare_func compare);
/** @brief similar to bsearch() but returns the index of the lower bound */
int tr_lowerBound(
void const* key,
void const* base,
size_t nmemb,
size_t size,
tr_voidptr_compare_func compar,
bool* exact_match) TR_GNUC_HOT TR_GNUC_NONNULL(1, 5, 6);
/* @} */