| 54 | } |
| 55 | |
| 56 | int vm_get_int(JSONValue obj, const char *name, int *pval) |
| 57 | { |
| 58 | JSONValue val; |
| 59 | val = json_object_get(obj, name); |
| 60 | if (json_is_undefined(val)) { |
| 61 | vm_error("expecting '%s' property\n", name); |
| 62 | return -1; |
| 63 | } |
| 64 | if (val.type != JSON_INT) { |
| 65 | vm_error("%s: integer expected\n", name); |
| 66 | return -1; |
| 67 | } |
| 68 | *pval = val.u.int32; |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | int vm_get_int_opt(JSONValue obj, const char *name, int *pval, int def_val) |
| 73 | { |
no test coverage detected