realloc -> stasis_realloc
This commit is contained in:
parent
649f85d218
commit
286370a3f1
20 changed files with 41 additions and 44 deletions
|
@ -647,8 +647,7 @@ int main(int argc, char **argv) {
|
||||||
assert(i < argc);
|
assert(i < argc);
|
||||||
column[column_count] = atoi(argv[i]);
|
column[column_count] = atoi(argv[i]);
|
||||||
column_count++;
|
column_count++;
|
||||||
column = reinterpret_cast<int*>(realloc(column,
|
column = stasis_realloc(column, column_count+1, int);
|
||||||
(column_count+1) * sizeof(int)));
|
|
||||||
} else if (!strcmp(argv[i], "-m")) {
|
} else if (!strcmp(argv[i], "-m")) {
|
||||||
multicolumn = 1;
|
multicolumn = 1;
|
||||||
} else if (!strcmp(argv[i], "-t")) {
|
} else if (!strcmp(argv[i], "-t")) {
|
||||||
|
@ -703,7 +702,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
val_t current = 0;
|
val_t current = 0;
|
||||||
|
|
||||||
// dataset is managed by malloc so that it can be realloc()'ed
|
// dataset is managed by malloc so that it can be realloc'ed
|
||||||
val_t **dataset;
|
val_t **dataset;
|
||||||
|
|
||||||
if(requested_column_count && file_mode) {
|
if(requested_column_count && file_mode) {
|
||||||
|
@ -802,8 +801,7 @@ int main(int argc, char **argv) {
|
||||||
} else {
|
} else {
|
||||||
inserts++;
|
inserts++;
|
||||||
for(int col = 0; col < column_count; col++) {
|
for(int col = 0; col < column_count; col++) {
|
||||||
dataset[col] = reinterpret_cast<val_t*>(
|
dataset[col] = stasis_realloc(dataset[col], (inserts + 1), val_t);
|
||||||
realloc(dataset[col], sizeof(val_t) * (inserts + 1)));
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char * endptr;
|
char * endptr;
|
||||||
dataset[col][inserts]
|
dataset[col][inserts]
|
||||||
|
|
|
@ -22,11 +22,11 @@ char ** split(char * in, char ** freeme, int* count, char * delim) {
|
||||||
char ** ret = 0;
|
char ** ret = 0;
|
||||||
while(tok) {
|
while(tok) {
|
||||||
(*count)++;
|
(*count)++;
|
||||||
ret = realloc(ret, sizeof(char*) * *count);
|
ret = stasis_realloc(ret, *count, char*);
|
||||||
ret[(*count)-1] = tok;
|
ret[(*count)-1] = tok;
|
||||||
tok = strtok_r(NULL,delim,&strtoks);
|
tok = strtok_r(NULL,delim,&strtoks);
|
||||||
}
|
}
|
||||||
ret = realloc(ret, sizeof(char*) * ((*count)+1));
|
ret = stasis_realloc(ret, (*count)+1, char*);
|
||||||
ret[*count]=0;
|
ret[*count]=0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ lladdIterator_t* ReferentialAlgebra_Join(int xid,
|
||||||
while(Titerator_next(xid, inner_it)) {
|
while(Titerator_next(xid, inner_it)) {
|
||||||
byte * in_val;
|
byte * in_val;
|
||||||
Titerator_value(xid, inner_it, (byte**)&in_val);
|
Titerator_value(xid, inner_it, (byte**)&in_val);
|
||||||
j->inner_tpls = realloc(j->inner_tpls, sizeof(tuple_t)*(i+1));
|
j->inner_tpls = stasis_realloc(j->inner_tpls, i+1, tuple_t);
|
||||||
j->inner_tpls[i] = tupleDup(*(tuple_t*)in_val);
|
j->inner_tpls[i] = tupleDup(*(tuple_t*)in_val);
|
||||||
Titerator_tupleDone(xid, inner_it);
|
Titerator_tupleDone(xid, inner_it);
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -113,16 +113,16 @@ tuple_t tupleAlloc() {
|
||||||
|
|
||||||
tuple_t tupleCatInt64(tuple_t t, int64_t i) {
|
tuple_t tupleCatInt64(tuple_t t, int64_t i) {
|
||||||
t.count++;
|
t.count++;
|
||||||
t.type = realloc(t.type,t.count * sizeof(t.type[0]));
|
t.type = stasis_realloc(t.type,t.count, datatype_t);
|
||||||
t.col = realloc(t.col,t.count * sizeof(t.col[0]));
|
t.col = stasis_realloc(t.col, t.count, tuplecol_t);
|
||||||
t.type[t.count-1] = int64_typ;
|
t.type[t.count-1] = int64_typ;
|
||||||
t.col[t.count-1].int64 = i;
|
t.col[t.count-1].int64 = i;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
tuple_t tupleCatString(tuple_t t, const char * str) {
|
tuple_t tupleCatString(tuple_t t, const char * str) {
|
||||||
t.count++;
|
t.count++;
|
||||||
t.type = realloc(t.type,t.count * sizeof(t.type[0]));
|
t.type = stasis_realloc(t.type,t.count,datatype_t);
|
||||||
t.col = realloc(t.col,t.count * sizeof(t.col[0]));
|
t.col = stasis_realloc(t.col,t.count,tuplecol_t);
|
||||||
t.type[t.count-1] = string_typ;
|
t.type[t.count-1] = string_typ;
|
||||||
t.col[t.count-1].string = strdup(str);
|
t.col[t.count-1].string = strdup(str);
|
||||||
return t;
|
return t;
|
||||||
|
|
|
@ -257,7 +257,7 @@ static int xidAllocedDealloced_helper_lookup_by_xid(struct rbtree *t, int xid, p
|
||||||
ret = 1;
|
ret = 1;
|
||||||
// add pageid to ret value
|
// add pageid to ret value
|
||||||
(*count)++;
|
(*count)++;
|
||||||
*pages = realloc(*pages, *count * sizeof(*pages[0]));
|
*pages = stasis_realloc(*pages, *count, pageid_t);
|
||||||
// printf("pages %x count %x *pages %x len %lld \n", pages, count, *pages, *count * sizeof(*pages[0]));
|
// printf("pages %x count %x *pages %x len %lld \n", pages, count, *pages, *count * sizeof(*pages[0]));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
(*pages)[(*count) - 1] = tup->pageid;
|
(*pages)[(*count) - 1] = tup->pageid;
|
||||||
|
@ -275,7 +275,7 @@ static int xidAllocedDealloced_helper_lookup_by_pageid(struct rbtree *t, pageid_
|
||||||
ret = 1;
|
ret = 1;
|
||||||
// add xid to ret value.
|
// add xid to ret value.
|
||||||
(*count)++;
|
(*count)++;
|
||||||
*xids = realloc(*xids, *count * sizeof(*xids[0]));
|
*xids = stasis_realloc(*xids, *count, int);
|
||||||
(*xids)[(*count) - 1] = tup->xid;
|
(*xids)[(*count) - 1] = tup->xid;
|
||||||
tup = rblookup(RB_LUGREAT, tup, t);
|
tup = rblookup(RB_LUGREAT, tup, t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ static Page * paLoadPage(stasis_buffer_manager_t *bm, stasis_buffer_manager_hand
|
||||||
stasis_buffer_manager_page_array_t *pa = bm->impl;
|
stasis_buffer_manager_page_array_t *pa = bm->impl;
|
||||||
pthread_mutex_lock(&pa->mut);
|
pthread_mutex_lock(&pa->mut);
|
||||||
if(pageid >= pa->pageCount) {
|
if(pageid >= pa->pageCount) {
|
||||||
pa->pageMap = realloc(pa->pageMap, (1+pageid) * sizeof(Page*));
|
pa->pageMap = stasis_realloc(pa->pageMap, 1+pageid, Page*);
|
||||||
for(pageid_t i = pa->pageCount; i <= pageid; i++) {
|
for(pageid_t i = pa->pageCount; i <= pageid; i++) {
|
||||||
pa->pageMap[i] = 0;
|
pa->pageMap[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ void stasis_dirty_page_table_flush_range(stasis_dirty_page_table_t * dirtyPages,
|
||||||
e && (stop == 0 || e->p < stop);
|
e && (stop == 0 || e->p < stop);
|
||||||
e = rblookup(RB_LUGREAT, e, dirtyPages->tableByPage)) {
|
e = rblookup(RB_LUGREAT, e, dirtyPages->tableByPage)) {
|
||||||
n++;
|
n++;
|
||||||
staleDirtyPages = realloc(staleDirtyPages, sizeof(pageid_t) * n);
|
staleDirtyPages = stasis_realloc(staleDirtyPages, n, pageid_t);
|
||||||
staleDirtyPages[n-1] = e->p;
|
staleDirtyPages[n-1] = e->p;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&dirtyPages->mutex);
|
pthread_mutex_unlock(&dirtyPages->mutex);
|
||||||
|
|
|
@ -40,8 +40,8 @@ static int stasis_log_structured_group_put(struct stasis_group_t* impl,
|
||||||
stasis_log_structured_group_entry_t * entry;
|
stasis_log_structured_group_entry_t * entry;
|
||||||
if((entry = LH_ENTRY(find)(g->table, k,keylen))) {
|
if((entry = LH_ENTRY(find)(g->table, k,keylen))) {
|
||||||
entry->count++;
|
entry->count++;
|
||||||
entry->val = realloc(entry->val, sizeof(entry->val[0])*entry->count);
|
entry->val = stasis_realloc(entry->val, entry->count, byte*);
|
||||||
entry->vallen = realloc(entry->vallen, sizeof(entry->vallen[0])*entry->count);
|
entry->vallen = stasis_realloc(entry->vallen, entry->count, size_t);
|
||||||
} else {
|
} else {
|
||||||
entry = malloc(sizeof(*entry));
|
entry = malloc(sizeof(*entry));
|
||||||
entry->val = malloc(sizeof(entry->val[0]));
|
entry->val = malloc(sizeof(entry->val[0]));
|
||||||
|
|
|
@ -100,7 +100,7 @@ int logMemory_Iterator_next (int xid, void * impl) {
|
||||||
|
|
||||||
byte * tmp;
|
byte * tmp;
|
||||||
|
|
||||||
tmp = realloc(fifo->cached_value, size);
|
tmp = stasis_realloc(fifo->cached_value, size, byte);
|
||||||
if(tmp == NULL) {
|
if(tmp == NULL) {
|
||||||
pthread_mutex_unlock(&(fifo->mutex));
|
pthread_mutex_unlock(&(fifo->mutex));
|
||||||
pthread_mutex_unlock(&(fifo->readerMutex));
|
pthread_mutex_unlock(&(fifo->readerMutex));
|
||||||
|
@ -167,7 +167,7 @@ int logMemory_Iterator_tryNext (int xid, void * impl) {
|
||||||
|
|
||||||
byte * tmp;
|
byte * tmp;
|
||||||
|
|
||||||
tmp = realloc(fifo->cached_value, size);
|
tmp = stasis_realloc(fifo->cached_value, size, byte);
|
||||||
if(tmp == NULL) {
|
if(tmp == NULL) {
|
||||||
pthread_mutex_unlock(&(fifo->mutex));
|
pthread_mutex_unlock(&(fifo->mutex));
|
||||||
pthread_mutex_unlock(&(fifo->readerMutex));
|
pthread_mutex_unlock(&(fifo->readerMutex));
|
||||||
|
@ -254,7 +254,7 @@ int logMemory_Iterator_nextOrEmpty (int xid, void * impl) {
|
||||||
|
|
||||||
byte * tmp;
|
byte * tmp;
|
||||||
|
|
||||||
tmp = realloc(fifo->cached_value, size);
|
tmp = stasis_realloc(fifo->cached_value, size, byte);
|
||||||
if(tmp == NULL) {
|
if(tmp == NULL) {
|
||||||
pthread_mutex_unlock(&(fifo->mutex));
|
pthread_mutex_unlock(&(fifo->mutex));
|
||||||
pthread_mutex_unlock(&(fifo->readerMutex));
|
pthread_mutex_unlock(&(fifo->readerMutex));
|
||||||
|
|
|
@ -59,7 +59,7 @@ static stasis_write_buffer_t * mem_write_buffer(stasis_handle_t * h,
|
||||||
} else {
|
} else {
|
||||||
byte * newbuf;
|
byte * newbuf;
|
||||||
if(off+len) {
|
if(off+len) {
|
||||||
newbuf = realloc(impl->buf, off+len);
|
newbuf = stasis_realloc(impl->buf, off+len, byte);
|
||||||
} else {
|
} else {
|
||||||
free(impl->buf);
|
free(impl->buf);
|
||||||
newbuf = stasis_malloc(0, byte);
|
newbuf = stasis_malloc(0, byte);
|
||||||
|
|
|
@ -195,9 +195,8 @@ static stasis_handle_t * getSlowHandle(nbw_impl * impl) {
|
||||||
slow = impl->slow_factory(impl->slow_factory_arg);
|
slow = impl->slow_factory(impl->slow_factory_arg);
|
||||||
pthread_mutex_lock(&impl->mut);
|
pthread_mutex_lock(&impl->mut);
|
||||||
impl->all_slow_handle_count++;
|
impl->all_slow_handle_count++;
|
||||||
impl->all_slow_handles
|
impl->all_slow_handles = stasis_realloc(impl->all_slow_handles,
|
||||||
= realloc(impl->all_slow_handles,
|
impl->all_slow_handle_count, stasis_handle_t*);
|
||||||
(impl->all_slow_handle_count) * sizeof(stasis_handle_t*));
|
|
||||||
impl->all_slow_handles[(impl->all_slow_handle_count)-1] = slow;
|
impl->all_slow_handles[(impl->all_slow_handle_count)-1] = slow;
|
||||||
pthread_mutex_unlock(&impl->mut);
|
pthread_mutex_unlock(&impl->mut);
|
||||||
} else {
|
} else {
|
||||||
|
@ -670,9 +669,9 @@ static void * nbw_worker(void * handle) {
|
||||||
dummy_count = 1;
|
dummy_count = 1;
|
||||||
first = 0;
|
first = 0;
|
||||||
} else {
|
} else {
|
||||||
buf = realloc(buf, len);
|
buf = stasis_realloc(buf, len, byte);
|
||||||
|
|
||||||
dummies = realloc(dummies, sizeof(tree_node) * (dummy_count+1));
|
dummies = stasis_realloc(dummies, dummy_count+1, tree_node);
|
||||||
dummies[dummy_count] = dummy;
|
dummies[dummy_count] = dummy;
|
||||||
dummy_count++;
|
dummy_count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ LogEntry* stasis_log_impl_in_memory_reserve_entry(struct stasis_log_t* log, size
|
||||||
writelock(impl->globalOffset_lock, 0);
|
writelock(impl->globalOffset_lock, 0);
|
||||||
} else {
|
} else {
|
||||||
impl->bufferLen *= 2;
|
impl->bufferLen *= 2;
|
||||||
impl->buffer = realloc(impl->buffer, impl->bufferLen * sizeof(LogEntry *));
|
impl->buffer = stasis_realloc(impl->buffer, impl->bufferLen, LogEntry *);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
done = 1;
|
done = 1;
|
||||||
|
|
|
@ -133,12 +133,12 @@ int stasis_transaction_table_register_callback(stasis_transaction_table_t *tbl,
|
||||||
stasis_transaction_table_callback_t **list = &tbl->commitCallbacks[type];
|
stasis_transaction_table_callback_t **list = &tbl->commitCallbacks[type];
|
||||||
int *count = &tbl->commitCallbackCount[type];
|
int *count = &tbl->commitCallbackCount[type];
|
||||||
|
|
||||||
*list = realloc(*list, (1+*count) * sizeof(*list[0]));
|
*list = stasis_realloc(*list, 1+*count, stasis_transaction_table_callback_t);
|
||||||
(*list)[*count] = cb;
|
(*list)[*count] = cb;
|
||||||
for(int i = 0; i < MAX_TRANSACTIONS; i++) {
|
for(int i = 0; i < MAX_TRANSACTIONS; i++) {
|
||||||
void *** args;
|
void *** args;
|
||||||
args = &tbl->table[i].commitArgs[type];
|
args = &tbl->table[i].commitArgs[type];
|
||||||
*args = realloc(*args, (1+*count) * sizeof(*args[0]));
|
*args = stasis_realloc(*args, 1+*count, void*);
|
||||||
(*args)[*count] = 0;
|
(*args)[*count] = 0;
|
||||||
}
|
}
|
||||||
return (*count)++;
|
return (*count)++;
|
||||||
|
@ -180,7 +180,7 @@ int* stasis_transaction_table_list_active(stasis_transaction_table_t *tbl, int *
|
||||||
if(e_xid >= 0) {
|
if(e_xid >= 0) {
|
||||||
ret[*count] = e_xid;
|
ret[*count] = e_xid;
|
||||||
(*count)++;
|
(*count)++;
|
||||||
ret = realloc(ret, ((*count)+1) * sizeof(*ret));
|
ret = stasis_realloc(ret, (*count)+1, int);
|
||||||
ret[*count] = INVALID_XID;
|
ret[*count] = INVALID_XID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,9 +343,9 @@ stasis_transaction_table_entry_t * stasis_transaction_table_begin(stasis_transac
|
||||||
if(test_and_set_entry(&tbl->table[i], INVALID_XTABLE_XID, PENDING_XTABLE_XID)) {
|
if(test_and_set_entry(&tbl->table[i], INVALID_XTABLE_XID, PENDING_XTABLE_XID)) {
|
||||||
index = i;
|
index = i;
|
||||||
tls->num_entries++;
|
tls->num_entries++;
|
||||||
tls->entries = realloc(tls->entries, sizeof(sizeof(ret)) * tls->num_entries);
|
tls->entries = stasis_realloc(tls->entries, tls->num_entries, stasis_transaction_table_entry_t*);
|
||||||
tls->entries[tls->num_entries-1] = &tbl->table[index];
|
tls->entries[tls->num_entries-1] = &tbl->table[index];
|
||||||
tls->indexes = realloc(tls->indexes, sizeof(int) * tls->num_entries);
|
tls->indexes = stasis_realloc(tls->indexes, tls->num_entries, int);
|
||||||
tls->indexes[tls->num_entries-1] = index;
|
tls->indexes[tls->num_entries-1] = index;
|
||||||
tbl->table[index].xidWhenFree = RESERVED_XTABLE_XID;
|
tbl->table[index].xidWhenFree = RESERVED_XTABLE_XID;
|
||||||
tbl->table[index].tid = tls->tid;
|
tbl->table[index].tid = tls->tid;
|
||||||
|
|
|
@ -164,8 +164,8 @@ static void extendHashTable(struct LH_ENTRY(table) * table) {
|
||||||
|
|
||||||
// Assumes realloc is reasonably fast... This seems to be a good
|
// Assumes realloc is reasonably fast... This seems to be a good
|
||||||
// assumption under linux.
|
// assumption under linux.
|
||||||
table->bucketList = realloc(table->bucketList,
|
table->bucketList = stasis_realloc(table->bucketList, 1+newBucket,
|
||||||
(1+newBucket) * sizeof(struct LH_ENTRY(pair_t)));
|
struct LH_ENTRY(pair_t));
|
||||||
table->bucketListLength = 1+newBucket;
|
table->bucketListLength = 1+newBucket;
|
||||||
table->bucketList[newBucket].key = 0;
|
table->bucketList[newBucket].key = 0;
|
||||||
table->bucketList[newBucket].keyLength = 0;
|
table->bucketList[newBucket].keyLength = 0;
|
||||||
|
|
|
@ -73,7 +73,7 @@ void stasis_aggregate_min_add(stasis_aggregate_min_t * min, lsn_t * a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
min->num_entries++;
|
min->num_entries++;
|
||||||
min->vals = realloc(min->vals, min->num_entries * sizeof(lsn_t**));
|
min->vals = stasis_realloc(min->vals, min->num_entries, lsn_t*);
|
||||||
*p = min->num_entries-1;
|
*p = min->num_entries-1;
|
||||||
min->vals[*p] = a;
|
min->vals[*p] = a;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -19,7 +19,7 @@ void stasis_util_multiset_destroy(stasis_util_multiset_t * set) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stasis_util_multiset_insert(stasis_util_multiset_t * set, lsn_t item) {
|
void stasis_util_multiset_insert(stasis_util_multiset_t * set, lsn_t item) {
|
||||||
set->items = realloc(set->items, (set->item_count+1)*sizeof(lsn_t));
|
set->items = stasis_realloc(set->items, set->item_count+1, lsn_t);
|
||||||
assert(set->items);
|
assert(set->items);
|
||||||
set->items[set->item_count] = item;
|
set->items[set->item_count] = item;
|
||||||
(set->item_count)++;
|
(set->item_count)++;
|
||||||
|
|
|
@ -70,7 +70,7 @@ void* stasis_util_slab_malloc(stasis_util_slab_t * slab) {
|
||||||
} else if(slab->this_block_count == slab->objs_per_block) {
|
} else if(slab->this_block_count == slab->objs_per_block) {
|
||||||
(slab->this_block_count) = 0;
|
(slab->this_block_count) = 0;
|
||||||
(slab->this_block) ++;
|
(slab->this_block) ++;
|
||||||
slab->blocks = realloc(slab->blocks, (slab->this_block+1) * sizeof(slab->blocks[0]));
|
slab->blocks = stasis_realloc(slab->blocks, slab->this_block+1, byte*);
|
||||||
assert(slab->blocks);
|
assert(slab->blocks);
|
||||||
slab->blocks[slab->this_block] = stasis_malloc(slab->block_sz, byte);
|
slab->blocks[slab->this_block] = stasis_malloc(slab->block_sz, byte);
|
||||||
assert(slab->blocks[slab->this_block]);
|
assert(slab->blocks[slab->this_block]);
|
||||||
|
|
|
@ -48,7 +48,7 @@ static inline void hazard_scan(hazard_t * h, hazard_ptr_rec_t * rec) {
|
||||||
pthread_mutex_lock(&h->tls_list_mut);
|
pthread_mutex_lock(&h->tls_list_mut);
|
||||||
hazard_ptr_rec_t * list = h->tls_list;
|
hazard_ptr_rec_t * list = h->tls_list;
|
||||||
while(list != NULL) {
|
while(list != NULL) {
|
||||||
ptrs = realloc(ptrs, sizeof(hazard_ptr) * (ptrs_len+h->num_slots));
|
ptrs = stasis_realloc(ptrs, ptrs_len+h->num_slots, hazard_ptr);
|
||||||
// int would_stop = 0;
|
// int would_stop = 0;
|
||||||
for(int i = 0; i < h->num_slots; i++) {
|
for(int i = 0; i < h->num_slots; i++) {
|
||||||
ptrs[ptrs_len] = list->hp[i];
|
ptrs[ptrs_len] = list->hp[i];
|
||||||
|
|
|
@ -23,8 +23,8 @@ static inline void stasis_histogram_thread_destroy(void * p) { free (p); }
|
||||||
void stasis_histogram_ctor_##x(void) { stasis_histogram_64_clear(&x); \
|
void stasis_histogram_ctor_##x(void) { stasis_histogram_64_clear(&x); \
|
||||||
pthread_key_create(&(x.tls), stasis_histogram_thread_destroy); \
|
pthread_key_create(&(x.tls), stasis_histogram_thread_destroy); \
|
||||||
stasis_auto_histogram_count++; \
|
stasis_auto_histogram_count++; \
|
||||||
stasis_auto_histograms = realloc(stasis_auto_histograms, sizeof(void*)*stasis_auto_histogram_count); \
|
stasis_auto_histograms = stasis_realloc(stasis_auto_histograms, stasis_auto_histogram_count, stasis_histogram_64_t*); \
|
||||||
stasis_auto_histogram_names = realloc(stasis_auto_histogram_names, sizeof(void*)*stasis_auto_histogram_count); \
|
stasis_auto_histogram_names = stasis_realloc(stasis_auto_histogram_names, stasis_auto_histogram_count, char*); \
|
||||||
stasis_auto_histograms[stasis_auto_histogram_count - 1] = &x; \
|
stasis_auto_histograms[stasis_auto_histogram_count - 1] = &x; \
|
||||||
stasis_auto_histogram_names[stasis_auto_histogram_count - 1] = __FILE__":"#x; \
|
stasis_auto_histogram_names[stasis_auto_histogram_count - 1] = __FILE__":"#x; \
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,8 +85,8 @@ static inline void tcase_add_checked_fixture(TCase * tc, void(*setup)(void), voi
|
||||||
#define tcase_add_test(tc, fcn) tcase_add_test_(tc, fcn, #fcn)
|
#define tcase_add_test(tc, fcn) tcase_add_test_(tc, fcn, #fcn)
|
||||||
static void tcase_add_test_(TCase * tc, void(*fcn)(void), const char* name) {
|
static void tcase_add_test_(TCase * tc, void(*fcn)(void), const char* name) {
|
||||||
(tc->count)++;
|
(tc->count)++;
|
||||||
tc->tests = realloc(tc->tests, sizeof(tc->tests[0])*tc->count);
|
tc->tests = (void(**)(void)) stasis_realloc(tc->tests, tc->count, void*);
|
||||||
tc->names = realloc(tc->names, sizeof(tc->names[0])*tc->count);
|
tc->names = stasis_realloc(tc->names, tc->count, char*);
|
||||||
tc->tests[tc->count-1] = fcn;
|
tc->tests[tc->count-1] = fcn;
|
||||||
tc->names[tc->count-1] = strdup(name);
|
tc->names[tc->count-1] = strdup(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ writeKeyToBuffer(char** insertBuffer, int* bufferCurrentLength,
|
||||||
*/
|
*/
|
||||||
if ((curLength + 15) > totalSize) {
|
if ((curLength + 15) > totalSize) {
|
||||||
totalSize *= 2;
|
totalSize *= 2;
|
||||||
*insertBuffer = (char*) realloc(*insertBuffer, totalSize);
|
*insertBuffer = stasis_realloc(*insertBuffer, totalSize, char);
|
||||||
*bufferTotalSize = totalSize;
|
*bufferTotalSize = totalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue