rm dupavlue and freevalue

This commit is contained in:
2026-02-25 09:52:06 -06:00
parent 20376aa5e4
commit 250f535abe
2 changed files with 2 additions and 6 deletions

View File

@@ -44,8 +44,6 @@ static JSValue js_layout_set_size(JSContext *js, JSValueConst self, int argc, JS
JSValue height_val = JS_GetPropertyNumber(js, argv[1], 1);
JS_ToFloat64(js, &width, width_val);
JS_ToFloat64(js, &height, height_val);
JS_FreeValue(js, width_val);
JS_FreeValue(js, height_val);
} else {
// Handle object with x,y or width,height properties
JSValue width_val = JS_GetPropertyStr(js, argv[1], "width");
@@ -58,8 +56,6 @@ static JSValue js_layout_set_size(JSContext *js, JSValueConst self, int argc, JS
}
JS_ToFloat64(js, &width, width_val);
JS_ToFloat64(js, &height, height_val);
JS_FreeValue(js, width_val);
JS_FreeValue(js, height_val);
}
if (isnan(width)) width = 0;

View File

@@ -73,7 +73,7 @@ float *js2floats(JSContext *js, JSValue v, size_t *len)
*len = JS_ArrayLength(js,v);
float *arr = malloc(sizeof(float)* *len);
for (int i = 0; i < *len; i++)
{ JSValue val = JS_GetPropertyNumber(js,v,i); arr[i] = js2number(js, val); JS_FreeValue(js,val); }
{ JSValue val = JS_GetPropertyNumber(js,v,i); arr[i] = js2number(js, val); }
return arr;
}
@@ -82,7 +82,7 @@ double *js2doubles(JSContext *js, JSValue v, size_t *len)
*len = JS_ArrayLength(js,v);
double *arr = malloc(sizeof(double)* *len);
for (int i = 0; i < *len; i++)
{ JSValue val = JS_GetPropertyNumber(js,v,i); arr[i] = js2number(js, val); JS_FreeValue(js,val); }
{ JSValue val = JS_GetPropertyNumber(js,v,i); arr[i] = js2number(js, val); }
return arr;
}