ptr_dec with inlined freeing method
This commit is contained in:
parent
ff6e6aa9c7
commit
cd97714ef5
@ -19,7 +19,7 @@ typedef struct ShArr {
|
||||
static ShArr* shObjS(usz* x) { return RFLD(x, ShArr, a); }
|
||||
static ShArr* shObj (B x) { return RFLD(a(x)->sh, ShArr, a); }
|
||||
static ShArr* shObjP(Value* x) { return RFLD(((Arr*)x)->sh, ShArr, a); }
|
||||
static void decSh(Value* x) { if (RARE(prnk(x)>1)) ptr_dec(shObjP(x));}
|
||||
static void decSh(Value* x) { if (RARE(prnk(x)>1)) tptr_dec(shObjP(x), mm_free); }
|
||||
|
||||
// some array stuff
|
||||
|
||||
|
||||
1
src/h.h
1
src/h.h
@ -498,6 +498,7 @@ static void dec(B x) {
|
||||
}
|
||||
static void ptr_dec(void* x) { if(!--VALIDATEP((Value*)x)->refc) value_free(x); }
|
||||
static void ptr_decR(void* x) { if(!--VALIDATEP((Value*)x)->refc) value_freeR(x); }
|
||||
#define tptr_dec(X, F) ({ Value* x_ = (Value*)(X); if (!--VALIDATEP(x_)->refc) F(x_); })
|
||||
static void decR(B x) {
|
||||
if (!isVal(VALIDATE(x))) return;
|
||||
Value* vx = v(x);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user