20 const char *text = NULL;
28 copy = (
char *)malloc(
len + 1);
32 memcpy(copy, text,
len);
44 int64_t signed_value = 0;
45 uint64_t unsigned_value = 0;
46 double real_value = 0.0;
52 if (signed_value < LONG_MIN || signed_value > LONG_MAX) {
55 *out = (long)signed_value;
60 if (unsigned_value > (uint64_t)LONG_MAX) {
63 *out = (long)unsigned_value;
70 if (real_value < (
double)LONG_MIN || real_value > (
double)LONG_MAX) {
73 if ((
double)((
long)real_value) != real_value) {
76 *out = (long)real_value;
89 const char *field_name,
90 const char *expected_value) {
93 if (array_value == NULL || field_name == NULL || expected_value == NULL) {
116 if (path == NULL || path[0] ==
'\0') {
172 long converted = default_value;
178 converted = default_value;
180 if (found_out != NULL) {
188 const char *migration_id) {
198 const char *backend_name) {
225 const char *text = NULL;
242 if (buffer.
data == NULL) {
void buffer_init(Buffer *buffer)
Initializes a growable buffer to an empty state.
char * dup_range(const char *start, size_t len)
Duplicates a byte range into a newly allocated NUL-terminated string.
void buffer_free(Buffer *buffer)
Releases memory owned by a growable buffer.
int buffer_append(Buffer *buffer, const void *data, size_t len)
Appends bytes to a growable buffer and maintains a trailing NUL byte.
char * read_file_text(const char *path)
Reads an entire file into a newly allocated text buffer.
Declares shared low-level support helpers used across the Pharos native runtime.
yyjson_doc * native_json_doc_load_file(const char *path)
Parses a JSON file into an owned yyjson document.
yyjson_val * native_json_find_migration_by_id(yyjson_val *root, const char *migration_id)
Finds a migration record by migration_id under a fixture root.
long native_json_obj_get_long_default(yyjson_val *obj, const char *key, long default_value, int *found_out)
Reads a numeric object member or returns a fallback value.
void native_json_doc_free(yyjson_doc *doc)
Releases a document returned by the native yyjson helpers.
static int native_json_long_from_value(yyjson_val *value, long *out)
Tests whether a numeric JSON value can be converted to long.
static char * native_json_string_dup(yyjson_val *value)
Duplicates a JSON string value into owned storage.
yyjson_val * native_json_find_backend_by_name(yyjson_val *root, const char *backend_name)
Finds a backend record by backend name under a fixture root.
yyjson_doc * native_json_doc_load_text(const char *text)
Parses JSON text into an owned yyjson document.
char * native_json_obj_get_string_dup(yyjson_val *obj, const char *key)
Duplicates a string-valued key from a JSON object.
char * native_json_string_array_lines_dup(yyjson_val *array_value)
Converts a JSON string array into newline-delimited text.
static yyjson_val * native_json_find_object_by_string_field(yyjson_val *array_value, const char *field_name, const char *expected_value)
Searches an object array for an element whose named field matches a string.
yyjson_val * native_json_obj_get_array(yyjson_val *obj, const char *key)
Looks up an array-valued key from a JSON object value.
yyjson_val * native_json_obj_get(yyjson_val *obj, const char *key)
Looks up a key from a JSON object value.
char * native_json_serialize_compact_dup(yyjson_val *value)
Serializes a JSON value to compact JSON text.
Declares shared helper wrappers around vendored yyjson parsing and serialization APIs.
Growable byte buffer used by parsing and string assembly helpers.
yyjson_api_inline char * yyjson_val_write(const yyjson_val *val, yyjson_write_flag flg, size_t *len)
yyjson_api_inline bool yyjson_is_str(const yyjson_val *val)
yyjson_api_inline bool yyjson_is_obj(const yyjson_val *val)
yyjson_api_inline bool yyjson_is_sint(const yyjson_val *val)
yyjson_api_inline uint64_t yyjson_get_uint(const yyjson_val *val)
yyjson_api_inline int64_t yyjson_get_sint(const yyjson_val *val)
yyjson_api_inline bool yyjson_is_arr(const yyjson_val *val)
yyjson_api_inline yyjson_val * yyjson_obj_get(const yyjson_val *obj, const char *key)
yyjson_api_inline bool yyjson_is_real(const yyjson_val *val)
static const yyjson_read_flag YYJSON_READ_NOFLAG
yyjson_api_inline bool yyjson_equals_str(const yyjson_val *val, const char *str)
yyjson_api_inline bool yyjson_is_uint(const yyjson_val *val)
yyjson_api_inline yyjson_val * yyjson_arr_iter_next(yyjson_arr_iter *iter)
yyjson_api_inline bool yyjson_is_num(const yyjson_val *val)
yyjson_api_inline size_t yyjson_get_len(const yyjson_val *val)
yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc)
static const yyjson_write_flag YYJSON_WRITE_NOFLAG
yyjson_api_inline const char * yyjson_get_str(const yyjson_val *val)
yyjson_api_inline double yyjson_get_real(const yyjson_val *val)
yyjson_api_inline yyjson_doc * yyjson_read(const char *dat, size_t len, yyjson_read_flag flg)
yyjson_api_inline bool yyjson_arr_iter_init(const yyjson_val *arr, yyjson_arr_iter *iter)