common: implement conversion from b_status to ivy_status
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include <blue/core/status.h>
|
||||
#include <ivy/status.h>
|
||||
|
||||
#define ENUM_STR(x) \
|
||||
@@ -18,3 +19,18 @@ const char *ivy_status_to_string(enum ivy_status status)
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
#define ENUM_CONVERT(from, to) \
|
||||
case (from): \
|
||||
return (to)
|
||||
|
||||
enum ivy_status ivy_status_from_b_status(enum b_status status)
|
||||
{
|
||||
switch (status) {
|
||||
ENUM_CONVERT(B_SUCCESS, IVY_OK);
|
||||
ENUM_CONVERT(B_ERR_NAME_EXISTS, IVY_ERR_NAME_EXISTS);
|
||||
ENUM_CONVERT(B_ERR_NO_MEMORY, IVY_ERR_NO_MEMORY);
|
||||
default:
|
||||
return IVY_ERR_INTERNAL_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user