Skip to content

Commit 769268b

Browse files
committed
rename TLS_last_allocation_error
1 parent 5713174 commit 769268b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/pool/pool_disjoint.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ typedef struct slab_t slab_t;
3131
typedef struct slab_list_item_t slab_list_item_t;
3232
typedef struct AllocImpl AllocImpl;
3333

34-
3534
slab_t *create_slab(bucket_t *bucket);
3635
void destroy_slab(slab_t *slab);
3736

@@ -98,8 +97,7 @@ critnib *AllocImpl_getKnownSlabs(AllocImpl *ai);
9897
size_t AllocImpl_SlabMinSize(AllocImpl *ai);
9998
umf_disjoint_pool_params_t *AllocImpl_getParams(AllocImpl *ai);
10099

101-
//static <- make static rename to TLS_last_allocation_error
102-
__TLS umf_result_t TLS_last_allocation_error_dp;
100+
static __TLS umf_result_t TLS_last_allocation_error;
103101

104102
// Allocations are a minimum of 4KB/64KB/2MB even when a smaller size is
105103
// requested. The implementation distinguishes between allocations of size
@@ -147,7 +145,6 @@ static size_t CutOff = (size_t)1 << 31; // 2GB
147145
void annotate_memory_inaccessible(void *ptr, size_t size);
148146
void annotate_memory_undefined(void *ptr, size_t size);
149147

150-
151148
typedef struct slab_list_item_t slab_list_item_t;
152149

153150
typedef struct bucket_t {
@@ -234,7 +231,6 @@ typedef struct slab_list_item_t {
234231
struct slab_list_item_t *prev, *next;
235232
} slab_list_item_t;
236233

237-
238234
typedef struct umf_disjoint_pool_shared_limits_t {
239235
size_t max_size;
240236
size_t total_size; // requires atomic access
@@ -991,7 +987,7 @@ static void *memoryProviderAlloc(umf_memory_provider_handle_t hProvider,
991987
void *ptr;
992988
umf_result_t ret = umfMemoryProviderAlloc(hProvider, size, alignment, &ptr);
993989
if (ret != UMF_RESULT_SUCCESS) {
994-
TLS_last_allocation_error_dp = ret;
990+
TLS_last_allocation_error = ret;
995991
return NULL;
996992
}
997993
annotate_memory_inaccessible(ptr, size);
@@ -1013,7 +1009,7 @@ static umf_result_t memoryProviderFree(umf_memory_provider_handle_t hProvider,
10131009
umf_result_t ret = umfMemoryProviderFree(hProvider, ptr, size);
10141010
if (ret != UMF_RESULT_SUCCESS) {
10151011

1016-
TLS_last_allocation_error_dp = ret;
1012+
TLS_last_allocation_error = ret;
10171013
// throw MemoryProviderError{ret};
10181014
return ret;
10191015
}
@@ -1033,7 +1029,7 @@ void *AllocImpl_allocate(AllocImpl *ai, size_t Size, bool *FromPool) {
10331029

10341030
if (Ptr == NULL) {
10351031
// TODO get code from func
1036-
TLS_last_allocation_error_dp = UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1032+
TLS_last_allocation_error = UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY;
10371033
return NULL;
10381034
}
10391035

@@ -1051,7 +1047,7 @@ void *AllocImpl_allocate(AllocImpl *ai, size_t Size, bool *FromPool) {
10511047

10521048
if (Ptr == NULL) {
10531049
// TODO get code from func
1054-
TLS_last_allocation_error_dp = UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1050+
TLS_last_allocation_error = UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY;
10551051
return NULL;
10561052
}
10571053

@@ -1256,7 +1252,7 @@ void *disjoint_pool_calloc(void *pool, size_t num, size_t size) {
12561252
(void)size;
12571253

12581254
// Not supported
1259-
TLS_last_allocation_error_dp = UMF_RESULT_ERROR_NOT_SUPPORTED;
1255+
TLS_last_allocation_error = UMF_RESULT_ERROR_NOT_SUPPORTED;
12601256
return NULL;
12611257
}
12621258

@@ -1266,7 +1262,7 @@ void *disjoint_pool_realloc(void *pool, void *ptr, size_t size) {
12661262
(void)size;
12671263

12681264
// Not supported
1269-
TLS_last_allocation_error_dp = UMF_RESULT_ERROR_NOT_SUPPORTED;
1265+
TLS_last_allocation_error = UMF_RESULT_ERROR_NOT_SUPPORTED;
12701266
return NULL;
12711267
}
12721268

@@ -1321,7 +1317,7 @@ umf_result_t disjoint_pool_free(void *pool, void *ptr) {
13211317
umf_result_t disjoint_pool_get_last_allocation_error(void *pool) {
13221318
(void)pool;
13231319

1324-
return TLS_last_allocation_error_dp;
1320+
return TLS_last_allocation_error;
13251321
}
13261322

13271323
// Define destructor for use with unique_ptr

0 commit comments

Comments
 (0)