add attributes to ghash and edgehash functions.
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
* \brief A general unordered 2-int pair hash table ADT.
|
||||
*/
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
|
||||
struct EdgeHash;
|
||||
struct EdgeHashIterator;
|
||||
typedef struct EdgeHash EdgeHash;
|
||||
@@ -42,27 +44,27 @@ enum {
|
||||
|
||||
EdgeHash *BLI_edgehash_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
EdgeHash *BLI_edgehash_new(const char *info);
|
||||
EdgeHash *BLI_edgehash_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp);
|
||||
void BLI_edgehash_insert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val);
|
||||
bool BLI_edgehash_reinsert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val);
|
||||
void *BLI_edgehash_lookup(EdgeHash *eh, unsigned int v0, unsigned int v1);
|
||||
void **BLI_edgehash_lookup_p(EdgeHash *eh, unsigned int v0, unsigned int v1);
|
||||
bool BLI_edgehash_haskey(EdgeHash *eh, unsigned int v0, unsigned int v1);
|
||||
int BLI_edgehash_size(EdgeHash *eh);
|
||||
void *BLI_edgehash_lookup(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
void **BLI_edgehash_lookup_p(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_edgehash_haskey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_edgehash_size(EdgeHash *eh) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP valfreefp,
|
||||
const unsigned int nentries_reserve);
|
||||
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp);
|
||||
void BLI_edgehash_flag_set(EdgeHash *eh, unsigned int flag);
|
||||
void BLI_edgehash_flag_clear(EdgeHash *eh, unsigned int flag);
|
||||
|
||||
EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh);
|
||||
EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgehashIterator_free(EdgeHashIterator *ehi);
|
||||
void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, unsigned int *v0_r, unsigned int *v1_r);
|
||||
void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi);
|
||||
void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val);
|
||||
void BLI_edgehashIterator_step(EdgeHashIterator *ehi);
|
||||
bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi);
|
||||
bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
#define BLI_EDGEHASH_SIZE_GUESS_FROM_LOOPS(totloop) ((totloop) / 2)
|
||||
#define BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(totpoly) ((totpoly) * 2)
|
||||
@@ -75,12 +77,12 @@ typedef struct EdgeSet EdgeSet;
|
||||
typedef struct EdgeSetIterator EdgeSetIterator;
|
||||
|
||||
EdgeSet *BLI_edgeset_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
EdgeSet *BLI_edgeset_new(const char *info);
|
||||
int BLI_edgeset_size(EdgeSet *es);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
EdgeSet *BLI_edgeset_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_edgeset_size(EdgeSet *es) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_edgeset_reinsert(EdgeSet *es, unsigned int v0, unsigned int v1);
|
||||
void BLI_edgeset_insert(EdgeSet *es, unsigned int v0, unsigned int v1);
|
||||
bool BLI_edgeset_haskey(EdgeSet *eh, unsigned int v0, unsigned int v1);
|
||||
bool BLI_edgeset_haskey(EdgeSet *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgeset_free(EdgeSet *es);
|
||||
|
||||
/* rely on inline api for now */
|
||||
|
@@ -34,6 +34,7 @@
|
||||
*/
|
||||
|
||||
#include "BLI_sys_types.h" /* for bool */
|
||||
#include "BLI_compiler_attrs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -59,35 +60,35 @@ enum {
|
||||
/* *** */
|
||||
|
||||
GHash *BLI_ghash_new_ex(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
|
||||
void BLI_ghash_insert(GHash *gh, void *key, void *val);
|
||||
bool BLI_ghash_reinsert(GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
|
||||
void *BLI_ghash_lookup(GHash *gh, const void *key);
|
||||
void **BLI_ghash_lookup_p(GHash *gh, const void *key);
|
||||
void *BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
|
||||
void **BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
|
||||
void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
|
||||
void BLI_ghash_clear_ex(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp,
|
||||
const unsigned int nentries_reserve);
|
||||
void *BLI_ghash_popkey(GHash *gh, void *key, GHashKeyFreeFP keyfreefp);
|
||||
bool BLI_ghash_haskey(GHash *gh, const void *key);
|
||||
int BLI_ghash_size(GHash *gh);
|
||||
void *BLI_ghash_popkey(GHash *gh, void *key, GHashKeyFreeFP keyfreefp) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_ghash_haskey(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_ghash_size(GHash *gh) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_ghash_flag_set(GHash *gh, unsigned int flag);
|
||||
void BLI_ghash_flag_clear(GHash *gh, unsigned int flag);
|
||||
|
||||
/* *** */
|
||||
|
||||
GHashIterator *BLI_ghashIterator_new(GHash *gh);
|
||||
GHashIterator *BLI_ghashIterator_new(GHash *gh) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh);
|
||||
void BLI_ghashIterator_free(GHashIterator *ghi);
|
||||
|
||||
void *BLI_ghashIterator_getKey(GHashIterator *ghi);
|
||||
void *BLI_ghashIterator_getValue(GHashIterator *ghi);
|
||||
void *BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
|
||||
void *BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
void BLI_ghashIterator_step(GHashIterator *ghi);
|
||||
bool BLI_ghashIterator_done(GHashIterator *ghi);
|
||||
bool BLI_ghashIterator_done(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
#define GHASH_ITER(gh_iter_, ghash_) \
|
||||
for (BLI_ghashIterator_init(&gh_iter_, ghash_); \
|
||||
@@ -111,17 +112,17 @@ unsigned int BLI_ghashutil_inthash(const void *ptr);
|
||||
int BLI_ghashutil_intcmp(const void *a, const void *b);
|
||||
|
||||
GHash *BLI_ghash_ptr_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
GHash *BLI_ghash_ptr_new(const char *info);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GHash *BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GHash *BLI_ghash_str_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
GHash *BLI_ghash_str_new(const char *info);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GHash *BLI_ghash_str_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GHash *BLI_ghash_int_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
GHash *BLI_ghash_int_new(const char *info);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GHash *BLI_ghash_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GHash *BLI_ghash_pair_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
GHash *BLI_ghash_pair_new(const char *info);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GHash *BLI_ghash_pair_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
typedef struct GHashPair {
|
||||
const void *first;
|
||||
@@ -152,24 +153,24 @@ typedef struct GSetIterator {
|
||||
} GSetIterator;
|
||||
|
||||
GSet *BLI_gset_new_ex(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info);
|
||||
int BLI_gset_size(GSet *gs);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_gset_size(GSet *gs) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp);
|
||||
void BLI_gset_insert(GSet *gh, void *key);
|
||||
bool BLI_gset_reinsert(GSet *gh, void *key, GSetKeyFreeFP keyfreefp);
|
||||
bool BLI_gset_haskey(GSet *gs, const void *key);
|
||||
bool BLI_gset_haskey(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_gset_remove(GSet *gs, void *key, GSetKeyFreeFP keyfreefp);
|
||||
void BLI_gset_clear_ex(GSet *gs, GSetKeyFreeFP keyfreefp,
|
||||
const unsigned int nentries_reserve);
|
||||
void BLI_gset_clear(GSet *gs, GSetKeyFreeFP keyfreefp);
|
||||
|
||||
GSet *BLI_gset_ptr_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GSet *BLI_gset_ptr_new(const char *info);
|
||||
GSet *BLI_gset_pair_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve);
|
||||
GSet *BLI_gset_pair_new(const char *info);
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GSet *BLI_gset_pair_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
/* rely on inline api for now */
|
||||
BLI_INLINE GSetIterator *BLI_gsetIterator_new(GSet *gs) { return (GSetIterator *)BLI_ghashIterator_new((GHash *)gs); }
|
||||
|
@@ -59,11 +59,7 @@ void BLI_memarena_use_calloc(struct MemArena *ma) ATTR_NONNULL(1)
|
||||
void BLI_memarena_use_align(struct MemArena *ma, const int align) ATTR_NONNULL(1);
|
||||
void *BLI_memarena_alloc(struct MemArena *ma, int size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2);
|
||||
|
||||
void BLI_memarena_clear(MemArena *ma)
|
||||
#if MEM_GNU_ATTRIBUTES
|
||||
__attribute__((nonnull(1)))
|
||||
#endif
|
||||
;
|
||||
void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -250,11 +250,7 @@ static void convert_tface_mt(FileData *fd, Main *main);
|
||||
* we could alternatively have a versions of a report function which forces printing - campbell
|
||||
*/
|
||||
|
||||
static void BKE_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((format(printf, 3, 4)))
|
||||
#endif
|
||||
;
|
||||
static void BKE_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...) ATTR_PRINTF_FORMAT(3, 4);
|
||||
static void BKE_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...)
|
||||
{
|
||||
char fixed_buf[1024]; /* should be long enough */
|
||||
|
@@ -2605,12 +2605,10 @@ static void confirm_cancel_operator(bContext *UNUSED(C), void *opv)
|
||||
WM_operator_free(opv);
|
||||
}
|
||||
|
||||
static void vconfirm_opname(bContext *C, const char *opname, const char *title, const char *itemfmt, va_list ap)
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((format(printf, 4, 0)))
|
||||
#endif
|
||||
;
|
||||
static void vconfirm_opname(bContext *C, const char *opname, const char *title, const char *itemfmt, va_list ap)
|
||||
static void vconfirm_opname(bContext *C, const char *opname, const char *title,
|
||||
const char *itemfmt, va_list ap) ATTR_PRINTF_FORMAT(4, 0);
|
||||
static void vconfirm_opname(bContext *C, const char *opname, const char *title,
|
||||
const char *itemfmt, va_list ap)
|
||||
{
|
||||
uiPopupBlockHandle *handle;
|
||||
char *s, buf[512];
|
||||
|
Reference in New Issue
Block a user