use TALLOCP in other places
This commit is contained in:
parent
40b76b840e
commit
1a583725be
@ -261,8 +261,7 @@ typedef struct {
|
|||||||
|
|
||||||
static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size) {
|
static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size) {
|
||||||
if (store->storage == NULL) {
|
if (store->storage == NULL) {
|
||||||
TALLOC(SORT_TYPE, tempstore, new_size);
|
store->storage = TALLOCP(SORT_TYPE, new_size);
|
||||||
store->storage = tempstore;
|
|
||||||
} else if (store->alloc < new_size) {
|
} else if (store->alloc < new_size) {
|
||||||
store->storage = (SORT_TYPE *)TREALLOC(store->storage, new_size * sizeof(SORT_TYPE));
|
store->storage = (SORT_TYPE *)TREALLOC(store->storage, new_size * sizeof(SORT_TYPE));
|
||||||
} else return;
|
} else return;
|
||||||
|
|||||||
@ -939,9 +939,8 @@ B sh_c2(B t, B w, B x) {
|
|||||||
iBufRaw = get_chars(inObj);
|
iBufRaw = get_chars(inObj);
|
||||||
iBuf = iBufRaw.data;
|
iBuf = iBufRaw.data;
|
||||||
} else {
|
} else {
|
||||||
TALLOC(char, iBufT, iLen);
|
iBuf = TALLOCP(char, iLen);
|
||||||
toUTF8(inObj, iBufT);
|
toUTF8(inObj, iBuf);
|
||||||
iBuf = iBufT;
|
|
||||||
}
|
}
|
||||||
} else iBuf = NULL;
|
} else iBuf = NULL;
|
||||||
#define FREE_INPUT do { if (iLen>0) { if (raw) free_chars(iBufRaw); else TFREE(iBuf); } } while(0)
|
#define FREE_INPUT do { if (iLen>0) { if (raw) free_chars(iBufRaw); else TFREE(iBuf); } } while(0)
|
||||||
@ -953,7 +952,6 @@ B sh_c2(B t, B w, B x) {
|
|||||||
|
|
||||||
// polling mess
|
// polling mess
|
||||||
const u64 bufsz = 1024;
|
const u64 bufsz = 1024;
|
||||||
// TALLOC(char, oBuf, bufsz);
|
|
||||||
u8* oBuf;
|
u8* oBuf;
|
||||||
B oBufObj = m_c8arrv(&oBuf, bufsz);
|
B oBufObj = m_c8arrv(&oBuf, bufsz);
|
||||||
usz* oBufIA = &a(oBufObj)->ia;
|
usz* oBufIA = &a(oBufObj)->ia;
|
||||||
|
|||||||
@ -175,8 +175,7 @@ CharBuf get_chars(B x) {
|
|||||||
buf = tyany_ptr(x);
|
buf = tyany_ptr(x);
|
||||||
alloc = false;
|
alloc = false;
|
||||||
} else {
|
} else {
|
||||||
TALLOC(char, val, len);
|
buf = TALLOCP(char, len);
|
||||||
buf = val;
|
|
||||||
alloc = true;
|
alloc = true;
|
||||||
SGetU(x)
|
SGetU(x)
|
||||||
for (u64 i = 0; i < len; i++) {
|
for (u64 i = 0; i < len; i++) {
|
||||||
|
|||||||
@ -21,11 +21,10 @@ NOINLINE u64 bqn_hashArr(B x, const u64 secret[4]) { // TODO manual separation o
|
|||||||
case el_i32: case el_c32: data = tyany_ptr(x); bytes = xia*4; break;
|
case el_i32: case el_c32: data = tyany_ptr(x); bytes = xia*4; break;
|
||||||
case el_f64: data = f64any_ptr(x); bytes = xia*8; break;
|
case el_f64: data = f64any_ptr(x); bytes = xia*8; break;
|
||||||
case el_B:;
|
case el_B:;
|
||||||
TALLOC(u64, dataTmp, xia);
|
data = TALLOCP(u64, xia);
|
||||||
isTemp = true;
|
isTemp = true;
|
||||||
SGetU(x)
|
SGetU(x)
|
||||||
for (usz i = 0; i < xia; i++) dataTmp[i] = bqn_hash(GetU(x, i), secret);
|
for (usz i = 0; i < xia; i++) ((u64*)data)[i] = bqn_hash(GetU(x, i), secret);
|
||||||
data = dataTmp;
|
|
||||||
bytes = xia*sizeof(B);
|
bytes = xia*sizeof(B);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
4
src/vm.c
4
src/vm.c
@ -183,7 +183,7 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl
|
|||||||
mCount = IA(b1); SGetU(b1)
|
mCount = IA(b1); SGetU(b1)
|
||||||
dCount = IA(b2); SGetU(b2)
|
dCount = IA(b2); SGetU(b2)
|
||||||
mapLen = mCount+dCount;
|
mapLen = mCount+dCount;
|
||||||
TALLOC(i32, bodyPs_, mapLen+2); bodyPs = bodyPs_;
|
bodyPs = TALLOCP(i32, mapLen+2);
|
||||||
i32* bodyM = bodyPs;
|
i32* bodyM = bodyPs;
|
||||||
i32* bodyD = bodyPs + mCount+1;
|
i32* bodyD = bodyPs + mCount+1;
|
||||||
for (i32 i = 0; i < mCount; i++) bodyM[i] = o2i(GetU(b1, i));
|
for (i32 i = 0; i < mCount; i++) bodyM[i] = o2i(GetU(b1, i));
|
||||||
@ -193,7 +193,7 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl
|
|||||||
bodyM[mCount] = bodyD[dCount] = I32_MAX;
|
bodyM[mCount] = bodyD[dCount] = I32_MAX;
|
||||||
} else {
|
} else {
|
||||||
mapLen = 2;
|
mapLen = 2;
|
||||||
TALLOC(i32, bodyPs_, mapLen+2); bodyPs = bodyPs_;
|
bodyPs = TALLOCP(i32, mapLen+2);
|
||||||
bodyPs[0] = bodyPs[2] = o2i(bodyObj);
|
bodyPs[0] = bodyPs[2] = o2i(bodyObj);
|
||||||
bodyPs[1] = bodyPs[3] = I32_MAX;
|
bodyPs[1] = bodyPs[3] = I32_MAX;
|
||||||
mCount = dCount = 1;
|
mCount = dCount = 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user