return r;
}
-int cli_dump_json(struct json_object* object) {
+int cli_dump_json(json_object* object) {
int r;
// Serialize the object as a JSON string
int cli_dump_repolist(pakfire_repolist* list, int flags);
-int cli_dump_json(struct json_object* object);
+int cli_dump_json(json_object* object);
#endif /* PAKFIRE_CLI_DUMP_H */
// metadata
unsigned int format;
- struct json_object* metadata;
+ json_object* metadata;
pakfire_filelist* filelist;
return r;
}
-static struct json_object* pakfire_archive_metadata_get_object(
+static json_object* pakfire_archive_metadata_get_object(
pakfire_archive* archive, const char* key1, const char* key2) {
- struct json_object* object = archive->metadata;
+ json_object* object = archive->metadata;
int r;
const char* keys[] = {
static const char* pakfire_archive_metadata_get(
pakfire_archive* archive, const char* key1, const char* key2) {
// Try finding an object
- struct json_object* object = pakfire_archive_metadata_get_object(archive, key1, key2);
+ json_object* object = pakfire_archive_metadata_get_object(archive, key1, key2);
if (!object)
return NULL;
static int64_t pakfire_archive_metadata_get_int64(
pakfire_archive* archive, const char* key1, const char* key2) {
// Try finding an object
- struct json_object* object = pakfire_archive_metadata_get_object(archive, key1, key2);
+ json_object* object = pakfire_archive_metadata_get_object(archive, key1, key2);
if (!object)
return 0;
static int pakfire_archive_import_filelist_from_json(
pakfire_archive* archive, pakfire_package* package) {
- struct json_object* array = NULL;
+ json_object* array = NULL;
int r;
// Fetch the array with the filelist
// Walk through all items in this array
for (unsigned int i = 0; i < length; i++) {
- struct json_object* item = json_object_array_get_idx(array, i);
+ json_object* item = json_object_array_get_idx(array, i);
if (!item)
continue;
}
// Groups
- struct json_object* groups = pakfire_archive_metadata_get_object(archive, "groups", NULL);
+ json_object* groups = pakfire_archive_metadata_get_object(archive, "groups", NULL);
if (groups) {
if (json_object_is_type(groups, json_type_array)) {
const size_t length = json_object_array_length(groups);
for (unsigned int i = 0; i < length; i++) {
- struct json_object* item = json_object_array_get_idx(groups, i);
+ json_object* item = json_object_array_get_idx(groups, i);
if (!item)
continue;
}
// Build arches
- struct json_object* build_arches = pakfire_archive_metadata_get_object(archive, "build", "arches");
+ json_object* build_arches = pakfire_archive_metadata_get_object(archive, "build", "arches");
if (build_arches && json_object_is_type(build_arches, json_type_array)) {
const size_t length = json_object_array_length(build_arches);
for (unsigned int i = 0; i < length; i++) {
- struct json_object* item = json_object_array_get_idx(build_arches, i);
+ json_object* item = json_object_array_get_idx(build_arches, i);
if (!item)
continue;
// Dependencies
for (const struct pakfire_dep* dep = pakfire_deps; dep->key; dep++) {
- struct json_object* array = pakfire_archive_metadata_get_object(
+ json_object* array = pakfire_archive_metadata_get_object(
archive, "dependencies", dep->name);
if (!array)
continue;
// Walk through all items in this array
for (unsigned int i = 0; i < length; i++) {
- struct json_object* item = json_object_array_get_idx(array, i);
+ json_object* item = json_object_array_get_idx(array, i);
if (!item)
continue;
}
int pakfire_archive_writer_create_file_from_json(
- pakfire_archive_writer* self, const char* path, mode_t mode, struct json_object* json) {
+ pakfire_archive_writer* self, const char* path, mode_t mode, json_object* json) {
const char* buffer = NULL;
size_t length = 0;
int pakfire_archive_writer_create_file(pakfire_archive_writer* self,
const char* path, mode_t mode, const char* payload, const size_t length);
int pakfire_archive_writer_create_file_from_json(pakfire_archive_writer* self,
- const char* path, mode_t mode, struct json_object* json);
+ const char* path, mode_t mode, json_object* json);
int pakfire_archive_writer_create_file_from_file(
pakfire_archive_writer* self, const char* path, mode_t mode, FILE* f);
struct pakfire_cpustat cpustat = {};
struct pakfire_loadavg loadavg = {};
struct pakfire_meminfo meminfo = {};
- struct json_object* stats = NULL;
- struct json_object* p = NULL;
+ json_object* stats = NULL;
+ json_object* p = NULL;
int r;
// Log action
Called when we have received a message for a specific job
*/
static int pakfire_builder_handle_job_message(
- pakfire_builder* self, const char* job_id, struct json_object* message) {
+ pakfire_builder* self, const char* job_id, json_object* message) {
pakfire_job* job = NULL;
int r;
Called when a new job has been received
*/
static int pakfire_builder_job(pakfire_builder* self, json_object* m) {
- struct json_object* data = NULL;
+ json_object* data = NULL;
pakfire_job* job = NULL;
int r;
}
-static int pakfire_builder_handle_message(pakfire_builder* self, struct json_object* message) {
+static int pakfire_builder_handle_message(pakfire_builder* self, json_object* message) {
const char* job_id = NULL;
const char* type = NULL;
int r;
int pakfire_builder_recv(pakfire_xfer* xfer,
const char* message, const size_t size, void* data) {
pakfire_builder* self = data;
- struct json_object* m = NULL;
+ json_object* m = NULL;
char* error = NULL;
int r;
return pakfire_builder_stream_logs(self);
}
-int pakfire_builder_send_message(pakfire_builder* self, struct json_object* message) {
+int pakfire_builder_send_message(pakfire_builder* self, json_object* message) {
const char* m = NULL;
size_t length = 0;
int r;
int pakfire_builder_recv(pakfire_xfer* xfer, const char* message, const size_t size, void* data);
int pakfire_builder_send(pakfire_xfer* xfer, void* data);
-int pakfire_builder_send_message(pakfire_builder* self, struct json_object* message);
+int pakfire_builder_send_message(pakfire_builder* self, json_object* message);
// Jobs
*/
static int pakfire_client_auth_refresh(pakfire_client* self) {
pakfire_xfer* xfer = NULL;
- struct json_object* request = NULL;
+ json_object* request = NULL;
int r;
// Require full authentication if we don't have all credentials
}
static int pakfire_client_store_read(pakfire_client* self) {
- struct json_object* store = NULL;
+ json_object* store = NULL;
const char* refresh_token = NULL;
const char* access_token = NULL;
char path[PATH_MAX];
}
static int pakfire_client_store_write(pakfire_client* self) {
- struct json_object* store = NULL;
+ json_object* store = NULL;
char path[PATH_MAX];
int r;
int pakfire_client_build(pakfire_client* self, const char* upload, const char* repo,
const char** arches, int flags, pakfire_xfer_response_callback callback, void* data) {
pakfire_xfer* xfer = NULL;
- struct json_object* request = NULL;
+ json_object* request = NULL;
int r;
// Create a new xfer
int pakfire_client_upload_create(pakfire_client* self,
const char* path, const char* filename, pakfire_client_upload_callback callback, void* data) {
pakfire_client_upload* upload = NULL;
- struct json_object* request = NULL;
+ json_object* request = NULL;
char* hexdigest_blake2b512 = NULL;
pakfire_xfer* xfer = NULL;
int r;
int pakfire_client_create_repo(pakfire_client* self,
const char* distro, const char* name, const char* description) {
pakfire_xfer* xfer = NULL;
- struct json_object* request = NULL;
+ json_object* request = NULL;
int r;
// Check inputs
*/
int pakfire_client_job_finished(pakfire_client* self,
const char* job_id, const char* logfile, char** packages) {
- struct json_object* request = NULL;
+ json_object* request = NULL;
pakfire_xfer* xfer = NULL;
int r;
static int pakfire_job_send_log_line(pakfire_job* job,
const struct timeval* timestamp, int priority, const char* line, size_t length) {
- struct json_object* message = NULL;
- struct json_object* data = NULL;
+ json_object* message = NULL;
+ json_object* data = NULL;
char* base64 = NULL;
char buffer[64];
int r;
return 0;
}
-int pakfire_job_handle_message(pakfire_job* self, struct json_object* message) {
+int pakfire_job_handle_message(pakfire_job* self, json_object* message) {
const char* command = NULL;
int r;
int pakfire_job_stream_logs(pakfire_job* self);
// Message Received
-int pakfire_job_handle_message(pakfire_job* self, struct json_object* message);
+int pakfire_job_handle_message(pakfire_job* self, json_object* message);
#endif /* PAKFIRE_JOB_H */
#include <pakfire/logging.h>
#include <pakfire/util.h>
-const char* pakfire_json_to_string(struct json_object* json, size_t* length) {
+const char* pakfire_json_to_string(json_object* json, size_t* length) {
const char* s = NULL;
const int flags = JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY;
}
int pakfire_json_to_file(const char* path, id_t owner, gid_t group, mode_t mode,
- struct json_object* json) {
+ json_object* json) {
const char* payload = NULL;
// Serialize the JSON object
return pakfire_file_write(path, owner, group, mode, "%s\n", payload);
}
-int pakfire_json_parse(struct json_object** json, char** error,
+int pakfire_json_parse(json_object** json, char** error,
const char* buffer, const size_t length) {
struct json_tokener* tokener = NULL;
- struct json_object* object = NULL;
+ json_object* object = NULL;
enum json_tokener_error e;
int r;
return r;
}
-static int pakfire_json_parse_file(struct json_object** json, char** error, FILE* f) {
+static int pakfire_json_parse_file(json_object** json, char** error, FILE* f) {
char* buffer = NULL;
size_t length = 0;
int r;
return r;
}
-int pakfire_json_parse_from_file(struct json_object** json, char** error, const char* path) {
+int pakfire_json_parse_from_file(json_object** json, char** error, const char* path) {
FILE* f = NULL;
int r;
return r;
}
-int pakfire_json_new_object(struct json_object** json) {
+int pakfire_json_new_object(json_object** json) {
// Make a new object
*json = json_object_new_object();
return 0;
}
-int pakfire_json_add_null(struct json_object* json, const char* name) {
+int pakfire_json_add_null(json_object* json, const char* name) {
return json_object_object_add(json, name, NULL);
}
-int pakfire_json_add_string(struct json_object* json,
+int pakfire_json_add_string(json_object* json,
const char* name, const char* value) {
if (!value)
return 0;
return pakfire_json_add_stringn(json, name, value, strlen(value));
}
-int pakfire_json_add_stringn(struct json_object* json,
+int pakfire_json_add_stringn(json_object* json,
const char* name, const char* value, size_t length) {
// No string? Nothing to do
if (!value)
return 0;
// Convert string to JSON object
- struct json_object* object = json_object_new_string_len(value, length);
+ json_object* object = json_object_new_string_len(value, length);
if (!object)
return 1;
return json_object_object_add(json, name, object);
}
-int pakfire_json_add_stringf(struct json_object* json,
+int pakfire_json_add_stringf(json_object* json,
const char* name, const char* format, ...) {
char* buffer = NULL;
va_list args;
return r;
}
-int pakfire_json_add_string_array(struct json_object* json, const char* name, char** array) {
+int pakfire_json_add_string_array(json_object* json, const char* name, char** array) {
int r = 1;
// Allocate a new array
- struct json_object* object = json_object_new_array();
+ json_object* object = json_object_new_array();
if (!object)
goto ERROR;
return r;
}
-int pakfire_json_add_bytes(struct json_object* json,
+int pakfire_json_add_bytes(json_object* json,
const char* name, const char* data, size_t length) {
char* bytes = NULL;
int r;
return r;
}
-int pakfire_json_add_int64(struct json_object* json, const char* name, int64_t value) {
+int pakfire_json_add_int64(json_object* json, const char* name, int64_t value) {
// Convert integer to JSON object
- struct json_object* object = json_object_new_int64(value);
+ json_object* object = json_object_new_int64(value);
if (!object)
return -errno;
return json_object_object_add(json, name, object);
}
-int pakfire_json_add_uint64(struct json_object* json, const char* name, uint64_t value) {
- struct json_object* object = NULL;
+int pakfire_json_add_uint64(json_object* json, const char* name, uint64_t value) {
+ json_object* object = NULL;
// Convert the value to JSON
object = json_object_new_uint64(value);
return json_object_object_add(json, name, object);
}
-int pakfire_json_add_double(struct json_object* json, const char* name, double value) {
- struct json_object* object = NULL;
+int pakfire_json_add_double(json_object* json, const char* name, double value) {
+ json_object* object = NULL;
// Convert the value to JSON
object = json_object_new_double(value);
return json_object_object_add(json, name, object);
}
-int pakfire_json_add_boolean(struct json_object* json, const char* name, int value) {
- struct json_object* object = NULL;
+int pakfire_json_add_boolean(json_object* json, const char* name, int value) {
+ json_object* object = NULL;
// Make a new boolean value
object = json_object_new_boolean(value);
return json_object_object_add(json, name, object);
}
-int pakfire_json_add_object(struct json_object* json, const char* name, struct json_object** o) {
- struct json_object* object = NULL;
+int pakfire_json_add_object(json_object* json, const char* name, json_object** o) {
+ json_object* object = NULL;
// Make a new object
object = json_object_new_object();
return json_object_object_add(json, name, object);
}
-int pakfire_json_add_array(struct json_object* json, const char* name, struct json_object** array) {
- struct json_object* object = NULL;
+int pakfire_json_add_array(json_object* json, const char* name, json_object** array) {
+ json_object* object = NULL;
// Make a new array
object = json_object_new_array();
return json_object_object_add(json, name, object);
}
-int pakfire_json_array_add_string(struct json_object* array, const char* s) {
+int pakfire_json_array_add_string(json_object* array, const char* s) {
// Make a new string object
- struct json_object* object = json_object_new_string_len(s, strlen(s));
+ json_object* object = json_object_new_string_len(s, strlen(s));
if (!object)
return -errno;
return json_object_array_add(array, object);
}
-int pakfire_json_array_add_stringf(struct json_object* array, const char* format, ...) {
+int pakfire_json_array_add_stringf(json_object* array, const char* format, ...) {
char* buffer = NULL;
va_list args;
int r;
return r;
}
-static int __pakfire_json_get_object(struct json_object* json,
- const char* key, const json_type type, struct json_object** o) {
- struct json_object* object = NULL;
+static int __pakfire_json_get_object(json_object* json,
+ const char* key, const json_type type, json_object** o) {
+ json_object* object = NULL;
int r;
// Fetch the object
return 0;
}
-int pakfire_json_get_string(struct json_object* json, const char* key, const char** value) {
- struct json_object* object = NULL;
+int pakfire_json_get_string(json_object* json, const char* key, const char** value) {
+ json_object* object = NULL;
int r;
// Fetch the object
return 0;
}
-int pakfire_json_get_int64(struct json_object* json, const char* key, int64_t* value) {
- struct json_object* object = NULL;
+int pakfire_json_get_int64(json_object* json, const char* key, int64_t* value) {
+ json_object* object = NULL;
int r;
// Fetch the object
return 0;
}
-int pakfire_json_get_object(struct json_object* json, const char* key, struct json_object** object) {
+int pakfire_json_get_object(json_object* json, const char* key, json_object** object) {
return __pakfire_json_get_object(json, key, json_type_object, object);
}
-int pakfire_json_get_array(struct json_object* json, const char* key, struct json_object** array) {
+int pakfire_json_get_array(json_object* json, const char* key, json_object** array) {
return __pakfire_json_get_object(json, key, json_type_array, array);
}
-int pakfire_json_write(struct json_object* json, const char* path) {
+int pakfire_json_write(json_object* json, const char* path) {
FILE* f = NULL;
int r;
#include <pakfire/ctx.h>
// To String
-const char* pakfire_json_to_string(struct json_object* json, size_t* length);
+const char* pakfire_json_to_string(json_object* json, size_t* length);
// To File
int pakfire_json_to_file(const char* path, id_t owner, gid_t group, mode_t mode,
- struct json_object* json);
+ json_object* json);
// Parse
-int pakfire_json_parse(struct json_object** json, char** error,
+int pakfire_json_parse(json_object** json, char** error,
const char* buffer, const size_t length);
// Parse from file
-int pakfire_json_parse_from_file(struct json_object** json, char** error, const char* path);
+int pakfire_json_parse_from_file(json_object** json, char** error, const char* path);
-int pakfire_json_new_object(struct json_object** json);
+int pakfire_json_new_object(json_object** json);
-int pakfire_json_add_null(struct json_object* json, const char* name);
-int pakfire_json_add_string(struct json_object* json, const char* name, const char* value);
-int pakfire_json_add_stringn(struct json_object* json, const char* name, const char* value, size_t length);
-int pakfire_json_add_stringf(struct json_object* json, const char* name, const char* format, ...)
+int pakfire_json_add_null(json_object* json, const char* name);
+int pakfire_json_add_string(json_object* json, const char* name, const char* value);
+int pakfire_json_add_stringn(json_object* json, const char* name, const char* value, size_t length);
+int pakfire_json_add_stringf(json_object* json, const char* name, const char* format, ...)
__attribute__((format(printf, 3, 4)));
-int pakfire_json_add_bytes(struct json_object* json, const char* name, const char* data, size_t length);
-int pakfire_json_add_int64(struct json_object* json, const char* name, int64_t value);
-int pakfire_json_add_uint64(struct json_object* json, const char* name, uint64_t value);
-int pakfire_json_add_double(struct json_object* json, const char* name, double value);
-int pakfire_json_add_boolean(struct json_object* json, const char* name, int value);
-int pakfire_json_add_string_array(struct json_object* json, const char* name, char** array);
-int pakfire_json_add_object(struct json_object* json, const char* name, struct json_object** o);
-int pakfire_json_add_array(struct json_object* json, const char* name, struct json_object** array);
+int pakfire_json_add_bytes(json_object* json, const char* name, const char* data, size_t length);
+int pakfire_json_add_int64(json_object* json, const char* name, int64_t value);
+int pakfire_json_add_uint64(json_object* json, const char* name, uint64_t value);
+int pakfire_json_add_double(json_object* json, const char* name, double value);
+int pakfire_json_add_boolean(json_object* json, const char* name, int value);
+int pakfire_json_add_string_array(json_object* json, const char* name, char** array);
+int pakfire_json_add_object(json_object* json, const char* name, json_object** o);
+int pakfire_json_add_array(json_object* json, const char* name, json_object** array);
-int pakfire_json_array_add_string(struct json_object* array, const char* s);
-int pakfire_json_array_add_stringf(struct json_object* array, const char* format, ...)
+int pakfire_json_array_add_string(json_object* array, const char* s);
+int pakfire_json_array_add_stringf(json_object* array, const char* format, ...)
__attribute__((format(printf, 2, 3)));
-int pakfire_json_get_string(struct json_object* json, const char* key, const char** value);
-int pakfire_json_get_int64(struct json_object* json, const char* key, int64_t* value);
-int pakfire_json_get_object(struct json_object* json, const char* key, struct json_object** object);
-int pakfire_json_get_array(struct json_object* json, const char* key, struct json_object** array);
+int pakfire_json_get_string(json_object* json, const char* key, const char** value);
+int pakfire_json_get_int64(json_object* json, const char* key, int64_t* value);
+int pakfire_json_get_object(json_object* json, const char* key, json_object** object);
+int pakfire_json_get_array(json_object* json, const char* key, json_object** array);
-int pakfire_json_write(struct json_object* json, const char* path);
+int pakfire_json_write(json_object* json, const char* path);
#endif /* PAKFIRE_JSON_H */
return r;
}
-int pakfire_jwt_payload(const char* token, struct json_object** payload) {
+int pakfire_jwt_payload(const char* token, json_object** payload) {
char* p = NULL;
size_t l = 0;
int r;
}
time_t pakfire_jwt_expires_at(const char* token) {
- struct json_object* payload = NULL;
+ json_object* payload = NULL;
time_t expires_at = -1;
int r;
#include <json.h>
-int pakfire_jwt_payload(const char* token, struct json_object** payload);
+int pakfire_jwt_payload(const char* token, json_object** payload);
time_t pakfire_jwt_expires_at(const char* token);
int pakfire_jwt_has_expired(const char* token);
}
static int pakfire_mirrorlist_check_mirrorlist(pakfire_mirrorlist* list,
- struct json_object* root) {
- struct json_object* typeobj = NULL;
+ json_object* root) {
+ json_object* typeobj = NULL;
int r;
r = json_object_object_get_ex(root, "type", &typeobj);
}
int pakfire_mirrorlist_read(pakfire_mirrorlist* list, const char* path) {
- struct json_object* json = NULL;
+ json_object* json = NULL;
char* error = NULL;
int r;
return 1;
}
- struct json_object* mirrors = NULL;
+ json_object* mirrors = NULL;
// Check if we found a valid mirrorlist
r = pakfire_mirrorlist_check_mirrorlist(list, json);
size_t num_mirrors = json_object_array_length(mirrors);
for (unsigned int i = 0; i < num_mirrors; i++) {
- struct json_object* mirror = json_object_array_get_idx(mirrors, i);
+ json_object* mirror = json_object_array_get_idx(mirrors, i);
if (!mirror)
continue;
// Find URL
- struct json_object* urlobj;
+ json_object* urlobj;
r = json_object_object_get_ex(mirror, "url", &urlobj);
if (!r)
goto ERROR;
char* diffid;
// JSON Objects
- struct json_object* config;
- struct json_object* layers;
- struct json_object* manifests;
+ json_object* config;
+ json_object* layers;
+ json_object* manifests;
};
static const char* pakfire_oci_arch(struct pakfire* pakfire) {
}
static int pakfire_oci_writer_write_oci_layout(struct pakfire_oci_writer* self) {
- struct json_object* o = NULL;
+ json_object* o = NULL;
int r;
// Make a new object
}
static int pakfire_oci_writer_write_json_blob(
- struct pakfire_oci_writer* self, struct json_object* json, char** hexdigest, size_t* size) {
+ struct pakfire_oci_writer* self, json_object* json, char** hexdigest, size_t* size) {
struct pakfire_hashes hashes = {};
const char* buffer = NULL;
char* hd = NULL;
}
static int pakfire_oci_writer_write_index(struct pakfire_oci_writer* self) {
- struct json_object* o = NULL;
+ json_object* o = NULL;
int r;
// Make a new object
}
static int pakfire_oci_writer_write_config(struct pakfire_oci_writer* self) {
- struct json_object* o = NULL;
+ json_object* o = NULL;
char* hexdigest = NULL;
char created[64];
size_t size = 0;
int r;
- struct json_object* config = NULL;
- struct json_object* cmd = NULL;
- struct json_object* rootfs = NULL;
- struct json_object* diffids = NULL;
+ json_object* config = NULL;
+ json_object* cmd = NULL;
+ json_object* rootfs = NULL;
+ json_object* diffids = NULL;
// Make a new object
r = pakfire_json_new_object(&o);
}
static int pakfire_oci_writer_write_manifest(struct pakfire_oci_writer* self) {
- struct json_object* manifest = NULL;
- struct json_object* platform = NULL;
- struct json_object* o = NULL;
+ json_object* manifest = NULL;
+ json_object* platform = NULL;
+ json_object* o = NULL;
char* hexdigest = NULL;
size_t size = 0;
int r;
char path[PATH_MAX] = PAKFIRE_TMP_DIR "/pakfire-oci-layer.XXXXXX";
pakfire_archive_writer* layer = NULL;
struct pakfire_hashes hashes = {};
- struct json_object* json = NULL;
+ json_object* json = NULL;
char filename[PATH_MAX];
char* hexdigest = NULL;
FILE* f = NULL;
static int _pakfire_package_add_json_dependencies(
pakfire_package* pkg,
- struct json_object* json,
+ json_object* json,
const char* name,
const enum pakfire_package_key key) {
int r;
}
static int pakfire_package_add_json_dependencies(
- pakfire_package* pkg, struct json_object* md) {
+ pakfire_package* pkg, json_object* md) {
int r = 0;
// Create new dependencies object
- struct json_object* object = json_object_new_object();
+ json_object* object = json_object_new_object();
if (!object)
return -errno;
static int __pakfire_package_add_json_filelist(
pakfire_ctx* ctx, pakfire_file* file, void* data) {
- struct json_object* filelist = data;
+ json_object* filelist = data;
int r;
// Fetch the file path
const char* path = pakfire_file_get_path(file);
// Create a new JSON string
- struct json_object* object = json_object_new_string(path);
+ json_object* object = json_object_new_string(path);
if (!object) {
r = -errno;
goto ERROR;
}
static int pakfire_package_add_json_filelist(
- pakfire_package* pkg, struct json_object* md) {
+ pakfire_package* pkg, json_object* md) {
pakfire_filelist* filelist = NULL;
- struct json_object* object = NULL;
+ json_object* object = NULL;
int r;
// Fetch the filelist
static int __pakfire_package_add_build_packages(pakfire_ctx* ctx,
pakfire_package* pkg, void* p) {
- struct json_object* object = (struct json_object*)p;
+ json_object* object = (json_object*)p;
int r;
const char* name = pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME);
}
static int pakfire_package_add_build_packages(pakfire_package* pkg,
- struct json_object* md) {
+ json_object* md) {
pakfire_repo* repo = NULL;
- struct json_object* object = NULL;
+ json_object* object = NULL;
int r;
// Create a new JSON array
}
static int pakfire_package_add_build_metadata(pakfire_package* pkg,
- struct json_object* md) {
+ json_object* md) {
int r;
// Create a new JSON object
- struct json_object* object = json_object_new_object();
+ json_object* object = json_object_new_object();
if (!object)
return -errno;
return r;
}
-int pakfire_package_to_json(pakfire_package* pkg, struct json_object** json) {
- struct json_object* md = NULL;
+int pakfire_package_to_json(pakfire_package* pkg, json_object** json) {
+ json_object* md = NULL;
int r = 0;
// Allocate a new JSON object
int pakfire_package_matches_dep(pakfire_package* pkg,
const enum pakfire_package_key key, const char* dep);
-int pakfire_package_to_json(pakfire_package* pkg, struct json_object** json);
+int pakfire_package_to_json(pakfire_package* pkg, json_object** json);
#endif /* PAKFIRE_PACKAGE_H */
static int pakfire_packager_write_metadata(pakfire_packager* packager,
pakfire_archive_writer* writer) {
- struct json_object* md = NULL;
+ json_object* md = NULL;
int r;
// Convert all package metadata to JSON
}
static int pakfire_repo_parse_repomd(pakfire_repo* self,
- pakfire_repomd* repomd, struct json_object* root) {
- struct json_object* files = NULL;
- struct json_object* file = NULL;
- struct json_object* chksums = NULL;
+ pakfire_repomd* repomd, json_object* root) {
+ json_object* files = NULL;
+ json_object* file = NULL;
+ json_object* chksums = NULL;
const char* type = NULL;
const char* filename = NULL;
ssize_t size = 0;
}
static int pakfire_repo_read_metadata(pakfire_repo* repo, const char* path) {
- struct json_object* json = NULL;
+ json_object* json = NULL;
char* error = NULL;
int r;
pakfire_repomd repomd = {};
pakfire_buffer buffer = {};
pakfire_xfer* xfer = NULL;
- struct json_object* json = NULL;
+ json_object* json = NULL;
char* error = NULL;
int r;
}
static int pakfire_repo_metadata_add_file(pakfire_repo* self,
- struct json_object* repomd, const char* type, const char* path) {
+ json_object* repomd, const char* type, const char* path) {
enum pakfire_hash_type hash = PAKFIRE_HASH_UNDEFINED;
struct pakfire_hashes checksums = {};
- struct json_object* files = NULL;
- struct json_object* file = NULL;
- struct json_object* chksums = NULL;
+ json_object* files = NULL;
+ json_object* file = NULL;
+ json_object* chksums = NULL;
char filename[PATH_MAX];
char* hexdigest = NULL;
struct stat st = {};
return r;
}
-static int pakfire_repo_write_database(pakfire_repo* self, struct json_object* repomd) {
+static int pakfire_repo_write_database(pakfire_repo* self, json_object* repomd) {
char filename[PATH_MAX];
char path[PATH_MAX];
char tmp[PATH_MAX];
return r;
}
-static int pakfire_repo_make_metadata(pakfire_repo* self, struct json_object* md) {
+static int pakfire_repo_make_metadata(pakfire_repo* self, json_object* md) {
int r;
// Set the version
}
int pakfire_repo_write_metadata(pakfire_repo* self, pakfire_key* key) {
- struct json_object* repomd = NULL;
+ json_object* repomd = NULL;
char repomd_path[PATH_MAX];
char sigpath[PATH_MAX];
FILE* f = NULL;
return 0;
}
-int pakfire_xfer_set_json_payload(pakfire_xfer* self, struct json_object* json) {
+int pakfire_xfer_set_json_payload(pakfire_xfer* self, json_object* json) {
const char* s = NULL;
int r;
// Payload
int pakfire_xfer_set_payload(pakfire_xfer* self, const char* payload);
-int pakfire_xfer_set_json_payload(pakfire_xfer* self, struct json_object* json);
+int pakfire_xfer_set_json_payload(pakfire_xfer* self, json_object* json);
// Output
int pakfire_xfer_set_output(pakfire_xfer* xfer, FILE* f);
const char* INVALID_TOKEN = "THISISANINVALIDTOKEN";
static int test_payload(const struct test* t) {
- struct json_object* payload = NULL;
+ json_object* payload = NULL;
int r = EXIT_FAILURE;
// Try to decode an invalid token