瀏覽代碼

Add allocator parameter to `json.detroy_value`

Igor Dreher 2 年之前
父節點
當前提交
95497626e3
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      core/encoding/json/types.odin

+ 5 - 5
core/encoding/json/types.odin

@@ -87,21 +87,21 @@ Error :: enum {
 
 
 
-destroy_value :: proc(value: Value) {
+destroy_value :: proc(value: Value, allocator := context.allocator) {
 	#partial switch v in value {
 	case Object:
 		for key, elem in v {
-			delete(key)
-			destroy_value(elem)
+			delete(key, allocator)
+			destroy_value(elem, allocator)
 		}
 		delete(v)
 	case Array:
 		for elem in v {
-			destroy_value(elem)
+			destroy_value(elem, allocator)
 		}
 		delete(v)
 	case String:
-		delete(v)
+		delete(v, allocator)
 	}
 }