| 86 | } |
| 87 | |
| 88 | static int vm_get_str2(JSONValue obj, const char *name, const char **pstr, |
| 89 | BOOL is_opt) |
| 90 | { |
| 91 | JSONValue val; |
| 92 | val = json_object_get(obj, name); |
| 93 | if (json_is_undefined(val)) { |
| 94 | if (is_opt) { |
| 95 | *pstr = NULL; |
| 96 | return 0; |
| 97 | } else { |
| 98 | vm_error("expecting '%s' property\n", name); |
| 99 | return -1; |
| 100 | } |
| 101 | } |
| 102 | if (val.type != JSON_STR) { |
| 103 | vm_error("%s: string expected\n", name); |
| 104 | return -1; |
| 105 | } |
| 106 | *pstr = val.u.str->data; |
| 107 | return 0; |
| 108 | } |
| 109 | |
| 110 | static int vm_get_str(JSONValue obj, const char *name, const char **pstr) |
| 111 | { |
no test coverage detected