mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-20 05:37:57 +00:00
Better support for Rhizome logging status enums
Provide functions that return non-NULL even on invalid enum values
This commit is contained in:
parent
dbe0cf862f
commit
86c3c7312c
12
rhizome.c
12
rhizome.c
@ -616,6 +616,12 @@ const char *rhizome_bundle_status_message(enum rhizome_bundle_status status)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *rhizome_bundle_status_message_nonnull(enum rhizome_bundle_status status)
|
||||
{
|
||||
const char *message = rhizome_bundle_status_message(status);
|
||||
return message ? message : "Invalid";
|
||||
}
|
||||
|
||||
const char *rhizome_payload_status_message(enum rhizome_payload_status status)
|
||||
{
|
||||
switch (status) {
|
||||
@ -631,3 +637,9 @@ const char *rhizome_payload_status_message(enum rhizome_payload_status status)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *rhizome_payload_status_message_nonnull(enum rhizome_payload_status status)
|
||||
{
|
||||
const char *message = rhizome_payload_status_message(status);
|
||||
return message ? message : "Invalid";
|
||||
}
|
||||
|
@ -416,6 +416,7 @@ enum rhizome_bundle_status {
|
||||
#define INVALID_RHIZOME_BUNDLE_STATUS ((enum rhizome_bundle_status)-2)
|
||||
|
||||
const char *rhizome_bundle_status_message(enum rhizome_bundle_status);
|
||||
const char *rhizome_bundle_status_message_nonnull(enum rhizome_bundle_status);
|
||||
|
||||
enum rhizome_payload_status {
|
||||
RHIZOME_PAYLOAD_STATUS_ERROR = -1,
|
||||
@ -432,6 +433,7 @@ enum rhizome_payload_status {
|
||||
#define INVALID_RHIZOME_PAYLOAD_STATUS ((enum rhizome_payload_status)-2)
|
||||
|
||||
const char *rhizome_payload_status_message(enum rhizome_payload_status);
|
||||
const char *rhizome_payload_status_message_nonnull(enum rhizome_payload_status);
|
||||
|
||||
int rhizome_write_manifest_file(rhizome_manifest *m, const char *filename, char append);
|
||||
int rhizome_manifest_selfsign(rhizome_manifest *m);
|
||||
|
Loading…
Reference in New Issue
Block a user