/
niceSOFT
/
dovecot
Обзор
Документация
Войти
/
niceSOFT
/
dovecot
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/lib/sort.h
33 строки
1013 B
Marco Bettini
lib: sort - Rename bsearch_(case)strcmp() into search_(case)strcmp()
12 фев 2025, 13:34
12 фев 2025, 13:34
369a2c0
Код
Авторство
О чём код?
#ifndef SORT_H #define SORT_H #define INTEGER_CMP(name, type) \ static inline int name(const type *i1, const type *i2) \ { \ if (*i1 < *i2) \ return -1; \ else if (*i1 > *i2) \ return 1; \ else \ return 0; \ } INTEGER_CMP(uint64_cmp, uint64_t) INTEGER_CMP(uint32_cmp, uint32_t) #define i_qsort(base, nmemb, size, cmp) \ qsort(base, nmemb, size - \ CALLBACK_TYPECHECK(cmp, int (*)(typeof(const typeof(*base) *), \ typeof(const typeof(*base) *))), \ (int (*)(const void *, const void *))cmp) #define i_bsearch(key, base, nmemb, size, cmp) \ bsearch(key, base, nmemb, size - \ CALLBACK_TYPECHECK(cmp, int (*)(typeof(const typeof(*key) *), \ typeof(const typeof(*base) *))), \ (int (*)(const void *, const void *))cmp) int search_strcmp(const char *key, const char *const *member) ATTR_PURE; int search_strcasecmp(const char *key, const char *const *member) ATTR_PURE; #endif