Phase 1 plus some refactoring.
This commit is contained in:
parent
71f7b4d96b
commit
8075e1b79d
17 changed files with 465 additions and 266 deletions
|
|
@ -2,45 +2,45 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct xt_app {
|
||||
struct xtc_app {
|
||||
unsigned int reserved;
|
||||
};
|
||||
|
||||
const char *xt_result_string(xt_result result)
|
||||
const char *xtc_result_string(xtc_result result)
|
||||
{
|
||||
switch (result) {
|
||||
case XT_OK: return "success";
|
||||
case XT_ERR_INVALID_ARGUMENT: return "invalid argument";
|
||||
case XT_ERR_OUT_OF_MEMORY: return "out of memory";
|
||||
case XT_ERR_NOT_FOUND: return "not found";
|
||||
case XT_ERR_INVALID_STATE: return "invalid state";
|
||||
case XT_ERR_IO: return "I/O error";
|
||||
case XT_ERR_UNSUPPORTED: return "unsupported operation";
|
||||
case XT_ERR_CAPACITY: return "capacity exceeded";
|
||||
case XT_ERR_GRAPH_CYCLE: return "graph contains a cycle";
|
||||
case XTC_OK: return "success";
|
||||
case XTC_ERR_INVALID_ARGUMENT: return "invalid argument";
|
||||
case XTC_ERR_OUT_OF_MEMORY: return "out of memory";
|
||||
case XTC_ERR_NOT_FOUND: return "not found";
|
||||
case XTC_ERR_INVALID_STATE: return "invalid state";
|
||||
case XTC_ERR_IO: return "I/O error";
|
||||
case XTC_ERR_UNSUPPORTED: return "unsupported operation";
|
||||
case XTC_ERR_CAPACITY: return "capacity exceeded";
|
||||
case XTC_ERR_GRAPH_CYCLE: return "graph contains a cycle";
|
||||
default: return "unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
xt_result xt_app_create(xt_app **out_app)
|
||||
xtc_result xtc_app_create(xtc_app **out_app)
|
||||
{
|
||||
xt_app *app;
|
||||
xtc_app *app;
|
||||
|
||||
if (out_app == NULL) {
|
||||
return XT_ERR_INVALID_ARGUMENT;
|
||||
return XTC_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
*out_app = NULL;
|
||||
|
||||
app = (xt_app *)calloc(1U, sizeof(*app));
|
||||
app = (xtc_app *)calloc(1U, sizeof(*app));
|
||||
if (app == NULL) {
|
||||
return XT_ERR_OUT_OF_MEMORY;
|
||||
return XTC_ERR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
*out_app = app;
|
||||
return XT_OK;
|
||||
return XTC_OK;
|
||||
}
|
||||
|
||||
void xt_app_destroy(xt_app *app)
|
||||
void xtc_app_destroy(xtc_app *app)
|
||||
{
|
||||
free(app);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue