use TALLOCP in other places

This commit is contained in:
dzaima 2022-09-07 17:59:17 +03:00
parent 40b76b840e
commit 1a583725be
5 changed files with 8 additions and 13 deletions

View File

@ -261,8 +261,7 @@ typedef struct {
static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size) {
if (store->storage == NULL) {
TALLOC(SORT_TYPE, tempstore, new_size);
store->storage = tempstore;
store->storage = TALLOCP(SORT_TYPE, new_size);
} else if (store->alloc < new_size) {
store->storage = (SORT_TYPE *)TREALLOC(store->storage, new_size * sizeof(SORT_TYPE));
} else return;

View File

@ -939,9 +939,8 @@ B sh_c2(B t, B w, B x) {
iBufRaw = get_chars(inObj);
iBuf = iBufRaw.data;
} else {
TALLOC(char, iBufT, iLen);
toUTF8(inObj, iBufT);
iBuf = iBufT;
iBuf = TALLOCP(char, iLen);
toUTF8(inObj, iBuf);
}
} else iBuf = NULL;
#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
const u64 bufsz = 1024;
// TALLOC(char, oBuf, bufsz);
u8* oBuf;
B oBufObj = m_c8arrv(&oBuf, bufsz);
usz* oBufIA = &a(oBufObj)->ia;

View File

@ -175,8 +175,7 @@ CharBuf get_chars(B x) {
buf = tyany_ptr(x);
alloc = false;
} else {
TALLOC(char, val, len);
buf = val;
buf = TALLOCP(char, len);
alloc = true;
SGetU(x)
for (u64 i = 0; i < len; i++) {

View File

@ -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_f64: data = f64any_ptr(x); bytes = xia*8; break;
case el_B:;
TALLOC(u64, dataTmp, xia);
data = TALLOCP(u64, xia);
isTemp = true;
SGetU(x)
for (usz i = 0; i < xia; i++) dataTmp[i] = bqn_hash(GetU(x, i), secret);
data = dataTmp;
for (usz i = 0; i < xia; i++) ((u64*)data)[i] = bqn_hash(GetU(x, i), secret);
bytes = xia*sizeof(B);
break;
}

View File

@ -183,7 +183,7 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl
mCount = IA(b1); SGetU(b1)
dCount = IA(b2); SGetU(b2)
mapLen = mCount+dCount;
TALLOC(i32, bodyPs_, mapLen+2); bodyPs = bodyPs_;
bodyPs = TALLOCP(i32, mapLen+2);
i32* bodyM = bodyPs;
i32* bodyD = bodyPs + mCount+1;
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;
} else {
mapLen = 2;
TALLOC(i32, bodyPs_, mapLen+2); bodyPs = bodyPs_;
bodyPs = TALLOCP(i32, mapLen+2);
bodyPs[0] = bodyPs[2] = o2i(bodyObj);
bodyPs[1] = bodyPs[3] = I32_MAX;
mCount = dCount = 1;