Make the tsd member init functions to take tsd_t * type.

This commit is contained in:
Qi Wang 2017-04-04 11:09:45 -07:00 committed by Qi Wang
parent d3cda3423c
commit 492e9f301e
3 changed files with 9 additions and 3 deletions

View File

@ -43,6 +43,7 @@ void rtree_leaf_elm_witness_access(tsdn_t *tsdn, const rtree_t *rtree,
const rtree_leaf_elm_t *elm); const rtree_leaf_elm_t *elm);
void rtree_leaf_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree, void rtree_leaf_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree,
const rtree_leaf_elm_t *elm); const rtree_leaf_elm_t *elm);
bool rtree_ctx_data_init(rtree_ctx_t *ctx); void rtree_ctx_data_init(rtree_ctx_t *ctx);
bool tsd_rtree_ctx_data_init(tsd_t *tsd);
#endif /* JEMALLOC_INTERNAL_RTREE_EXTERNS_H */ #endif /* JEMALLOC_INTERNAL_RTREE_EXTERNS_H */

View File

@ -425,13 +425,18 @@ rtree_leaf_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree,
rtree_leaf_elm_witness_dalloc(tsdn_tsd(tsdn), witness, elm); rtree_leaf_elm_witness_dalloc(tsdn_tsd(tsdn), witness, elm);
} }
bool void
rtree_ctx_data_init(rtree_ctx_t *ctx) { rtree_ctx_data_init(rtree_ctx_t *ctx) {
for (unsigned i = 0; i < RTREE_CTX_NCACHE; i++) { for (unsigned i = 0; i < RTREE_CTX_NCACHE; i++) {
rtree_ctx_cache_elm_t *cache = &ctx->cache[i]; rtree_ctx_cache_elm_t *cache = &ctx->cache[i];
cache->leafkey = RTREE_LEAFKEY_INVALID; cache->leafkey = RTREE_LEAFKEY_INVALID;
cache->leaf = NULL; cache->leaf = NULL;
} }
}
bool
tsd_rtree_ctx_data_init(tsd_t *tsd) {
rtree_ctx_data_init(&tsd->rtree_ctx);
return false; return false;
} }

View File

@ -64,7 +64,7 @@ bool
tsd_data_init(void *arg) { tsd_data_init(void *arg) {
tsd_t *tsd = (tsd_t *)arg; tsd_t *tsd = (tsd_t *)arg;
#define MALLOC_TSD_init_yes(n, t) \ #define MALLOC_TSD_init_yes(n, t) \
if (n##_data_init(&tsd->n)) { \ if (tsd_##n##_data_init(tsd)) { \
return true; \ return true; \
} }
#define MALLOC_TSD_init_no(n, t) #define MALLOC_TSD_init_no(n, t)