Sync with latest ras-decode @bc6b43c (#770)
Signed-off-by: Oosman Saeed <oossaeed@amd.com>
[ROCm/amdsmi commit: 90f4b8c43d]
This commit is contained in:
@@ -33,14 +33,7 @@ extern "C" {
|
||||
/**
|
||||
* @brief JSON value types enumeration
|
||||
*/
|
||||
typedef enum {
|
||||
JSON_NULL,
|
||||
JSON_BOOL,
|
||||
JSON_NUMBER,
|
||||
JSON_STRING,
|
||||
JSON_OBJECT,
|
||||
JSON_ARRAY
|
||||
} JsonType;
|
||||
typedef enum { JSON_NULL, JSON_BOOL, JSON_NUMBER, JSON_STRING, JSON_OBJECT, JSON_ARRAY } JsonType;
|
||||
|
||||
typedef struct JsonValue JsonValue;
|
||||
typedef struct JsonPair JsonPair;
|
||||
@@ -49,67 +42,67 @@ typedef struct JsonPair JsonPair;
|
||||
* @brief JSON key-value pair structure for objects
|
||||
*/
|
||||
struct JsonPair {
|
||||
char *key;
|
||||
JsonValue *value;
|
||||
JsonPair *next;
|
||||
char *key;
|
||||
JsonValue *value;
|
||||
JsonPair *next;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief JSON value structure
|
||||
*/
|
||||
struct JsonValue {
|
||||
JsonType type;
|
||||
union {
|
||||
bool boolean;
|
||||
double number;
|
||||
char *string;
|
||||
JsonPair *object; // Linked list of key-value pairs
|
||||
struct {
|
||||
JsonValue **items;
|
||||
size_t count;
|
||||
size_t capacity;
|
||||
} array;
|
||||
} data;
|
||||
JsonType type;
|
||||
union {
|
||||
bool boolean;
|
||||
double number;
|
||||
char *string;
|
||||
JsonPair *object; // Linked list of key-value pairs
|
||||
struct {
|
||||
JsonValue **items;
|
||||
size_t count;
|
||||
size_t capacity;
|
||||
} array;
|
||||
} data;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Create a null JSON value
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_null(void);
|
||||
JsonValue *json_create_null(void);
|
||||
|
||||
/**
|
||||
* @brief Create a boolean JSON value
|
||||
* @param b Boolean value
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_bool(bool b);
|
||||
JsonValue *json_create_bool(bool b);
|
||||
|
||||
/**
|
||||
* @brief Create a number JSON value
|
||||
* @param num Numeric value
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_number(double num);
|
||||
JsonValue *json_create_number(double num);
|
||||
|
||||
/**
|
||||
* @brief Create a string JSON value
|
||||
* @param str String value (will be copied)
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_string(const char *str);
|
||||
JsonValue *json_create_string(const char *str);
|
||||
|
||||
/**
|
||||
* @brief Create an empty JSON object
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_object(void);
|
||||
JsonValue *json_create_object(void);
|
||||
|
||||
/**
|
||||
* @brief Create an empty JSON array
|
||||
* @return Pointer to new JsonValue or NULL on failure
|
||||
*/
|
||||
JsonValue* json_create_array(void);
|
||||
JsonValue *json_create_array(void);
|
||||
|
||||
/**
|
||||
* @brief Add a key-value pair to a JSON object
|
||||
@@ -125,7 +118,7 @@ void json_object_set(JsonValue *obj, const char *key, JsonValue *value);
|
||||
* @param key Key to search for
|
||||
* @return Pointer to JsonValue or NULL if not found
|
||||
*/
|
||||
JsonValue* json_object_get(JsonValue *obj, const char *key);
|
||||
JsonValue *json_object_get(JsonValue *obj, const char *key);
|
||||
|
||||
/**
|
||||
* @brief Check if a key exists in a JSON object
|
||||
@@ -149,7 +142,7 @@ bool json_array_push(JsonValue *arr, JsonValue *value);
|
||||
* @param index Array index
|
||||
* @return Pointer to JsonValue or NULL if index out of bounds
|
||||
*/
|
||||
JsonValue* json_array_get(JsonValue *arr, size_t index);
|
||||
JsonValue *json_array_get(JsonValue *arr, size_t index);
|
||||
|
||||
/**
|
||||
* @brief Get the size of a JSON array
|
||||
|
||||
Reference in New Issue
Block a user