meta: replace bluelib with fx

This commit is contained in:
2026-06-22 17:45:54 +01:00
parent 4190a5c54a
commit c6c4b0c1f9
81 changed files with 3933 additions and 1349 deletions
+49 -49
View File
@@ -1,6 +1,6 @@
#include "manifest.h"
#include <blue/object/string.h>
#include <fx/string.h>
#include <ropkg/manifest.h>
#include <stdlib.h>
#include <string.h>
@@ -51,26 +51,26 @@ enum ropkg_status ropkg_manifest_create(struct ropkg_manifest **out)
void ropkg_manifest_destroy(struct ropkg_manifest *manifest)
{
b_queue_entry *entry = b_queue_pop_back(&manifest->m_values);
fx_queue_entry *entry = fx_queue_pop_back(&manifest->m_values);
while (entry) {
struct ropkg_manifest_value *value
= b_unbox(struct ropkg_manifest_value, entry, v_entry);
= fx_unbox(struct ropkg_manifest_value, entry, v_entry);
ropkg_manifest_value_destroy(value);
entry = b_queue_pop_back(&manifest->m_values);
entry = fx_queue_pop_back(&manifest->m_values);
}
free(manifest);
}
static b_result create_manifest_value(
b_string *name,
b_string *value,
static fx_result create_manifest_value(
fx_string *name,
fx_string *value,
struct ropkg_manifest_value **out)
{
const char *name_cstr = b_string_ptr(name);
const char *name_cstr = fx_string_get_cstr(name);
enum ropkg_manifest_value_id id = value_id_from_string(name_cstr);
const char *value_cstr = b_string_ptr(value);
const char *value_cstr = fx_string_get_cstr(value);
char *ep;
size_t v = strtoull(value_cstr, &ep, 10);
struct ropkg_manifest_value *result = NULL;
@@ -103,14 +103,14 @@ static b_result create_manifest_value(
}
if (status != ROPKG_SUCCESS) {
return b_error_with_code(ROPKG_ERROR_VENDOR, status);
return fx_error_with_code(ROPKG_ERROR_VENDOR, status);
}
*out = result;
return B_RESULT_SUCCESS;
return FX_RESULT_SUCCESS;
}
b_result ropkg_manifest_parse(FILE *fp, struct ropkg_manifest *dest)
fx_result ropkg_manifest_parse(FILE *fp, struct ropkg_manifest *dest)
{
enum parser_state {
PARSER_STATE_NAME,
@@ -118,9 +118,9 @@ b_result ropkg_manifest_parse(FILE *fp, struct ropkg_manifest *dest)
} parser_state = PARSER_STATE_NAME;
enum ropkg_status status = ROPKG_SUCCESS;
b_result result = B_RESULT_SUCCESS;
b_string *name = b_string_create();
b_string *value_string = b_string_create();
fx_result result = FX_RESULT_SUCCESS;
fx_string *name = fx_string_create();
fx_string *value_string = fx_string_create();
struct ropkg_manifest_value *value = NULL;
char s[2] = {0};
@@ -137,7 +137,7 @@ b_result ropkg_manifest_parse(FILE *fp, struct ropkg_manifest *dest)
}
s[0] = c;
b_string_append_cstr(value_string, s);
fx_string_append_cstr(value_string, s);
continue;
case '\n':
if (parser_state == PARSER_STATE_NAME) {
@@ -149,50 +149,50 @@ b_result ropkg_manifest_parse(FILE *fp, struct ropkg_manifest *dest)
name,
value_string,
&value);
if (b_result_is_error(result)) {
if (fx_result_is_error(result)) {
done = true;
break;
}
status = ropkg_manifest_put(dest, value);
if (status != ROPKG_SUCCESS) {
result = b_error_with_code(
result = fx_error_with_code(
ROPKG_ERROR_VENDOR,
status);
done = true;
break;
}
b_string_clear(name);
b_string_clear(value_string);
fx_string_clear(name);
fx_string_clear(value_string);
parser_state = PARSER_STATE_NAME;
break;
case ' ':
case '\t':
if (parser_state == PARSER_STATE_NAME
&& b_string_get_size(name, 0) == 0) {
&& fx_string_get_size(name, 0) == 0) {
break;
}
if (parser_state == PARSER_STATE_VALUE
&& b_string_get_size(value_string, 0) == 0) {
&& fx_string_get_size(value_string, 0) == 0) {
break;
}
default:
s[0] = c;
if (parser_state == PARSER_STATE_NAME) {
b_string_append_cstr(name, s);
fx_string_append_cstr(name, s);
} else {
b_string_append_cstr(value_string, s);
fx_string_append_cstr(value_string, s);
}
break;
}
}
b_string_release(name);
b_string_release(value_string);
fx_string_unref(name);
fx_string_unref(value_string);
return result;
}
@@ -202,17 +202,17 @@ enum ropkg_status ropkg_manifest_get_by_name(
const char *name,
struct ropkg_manifest_value **out)
{
b_queue_iterator it;
b_queue_foreach(&it, &manifest->m_values)
{
struct ropkg_manifest_value *value = b_unbox(
struct ropkg_manifest_value,
it.entry,
v_entry);
fx_queue_entry *entry = fx_queue_first(&manifest->m_values);
while (entry) {
struct ropkg_manifest_value *value
= fx_unbox(struct ropkg_manifest_value, entry, v_entry);
if (value->v_name && !strcmp(value->v_name, name)) {
*out = value;
return ROPKG_SUCCESS;
}
entry = fx_queue_next(entry);
}
return ROPKG_ERR_NO_ENTRY;
@@ -223,18 +223,18 @@ enum ropkg_status ropkg_manifest_get_by_id(
enum ropkg_manifest_value_id id,
struct ropkg_manifest_value **out)
{
b_queue_iterator it;
b_queue_foreach(&it, &manifest->m_values)
{
struct ropkg_manifest_value *value = b_unbox(
struct ropkg_manifest_value,
it.entry,
v_entry);
fx_queue_entry *entry = fx_queue_first(&manifest->m_values);
while (entry) {
struct ropkg_manifest_value *value
= fx_unbox(struct ropkg_manifest_value, entry, v_entry);
if (value->v_id != ROPKG_MANIFEST_VALUE_N_NONE
&& value->v_id == id) {
*out = value;
return ROPKG_SUCCESS;
}
entry = fx_queue_next(entry);
}
return ROPKG_ERR_NO_ENTRY;
@@ -261,7 +261,7 @@ enum ropkg_status ropkg_manifest_put(
return ROPKG_ERR_NAME_EXISTS;
}
b_queue_push_back(&manifest->m_values, &value->v_entry);
fx_queue_push_back(&manifest->m_values, &value->v_entry);
return ROPKG_SUCCESS;
}
@@ -269,24 +269,24 @@ enum ropkg_status ropkg_manifest_put(
const struct ropkg_manifest_value *ropkg_manifest_get_first_value(
const struct ropkg_manifest *manifest)
{
b_queue_entry *entry = b_queue_first(&manifest->m_values);
fx_queue_entry *entry = fx_queue_first(&manifest->m_values);
if (!entry) {
return NULL;
}
return b_unbox(struct ropkg_manifest_value, entry, v_entry);
return fx_unbox(struct ropkg_manifest_value, entry, v_entry);
}
const struct ropkg_manifest_value *ropkg_manifest_get_next_value(
const struct ropkg_manifest *manifest,
const struct ropkg_manifest_value *value)
{
b_queue_entry *entry = b_queue_next(&value->v_entry);
fx_queue_entry *entry = fx_queue_next(&value->v_entry);
if (!entry) {
return NULL;
}
return b_unbox(struct ropkg_manifest_value, entry, v_entry);
return fx_unbox(struct ropkg_manifest_value, entry, v_entry);
}
enum ropkg_status ropkg_manifest_value_create_int_with_name(
@@ -302,7 +302,7 @@ enum ropkg_status ropkg_manifest_value_create_int_with_name(
memset(vp, 0x0, sizeof *vp);
vp->v_type = ROPKG_MANIFEST_VALUE_T_INT;
vp->v_name = b_strdup(name);
vp->v_name = fx_strdup(name);
if (!vp->v_name) {
free(vp);
@@ -349,14 +349,14 @@ enum ropkg_status ropkg_manifest_value_create_string_with_name(
memset(vp, 0x0, sizeof *vp);
vp->v_type = ROPKG_MANIFEST_VALUE_T_STRING;
vp->v_name = b_strdup(vp->v_name);
vp->v_name = fx_strdup(vp->v_name);
if (!vp->v_name) {
free(vp);
return ROPKG_ERR_NO_MEMORY;
}
vp->v_value.s = b_strdup(value);
vp->v_value.s = fx_strdup(value);
if (!vp->v_value.s) {
free(vp);
return ROPKG_ERR_NO_MEMORY;
@@ -380,7 +380,7 @@ enum ropkg_status ropkg_manifest_value_create_string_with_id(
vp->v_type = ROPKG_MANIFEST_VALUE_T_STRING;
vp->v_id = id;
vp->v_value.s = b_strdup(value);
vp->v_value.s = fx_strdup(value);
if (!vp->v_value.s) {
free(vp);
return ROPKG_ERR_NO_MEMORY;