chore: static inline sandbox_state_stringify

main
Sean McBride 4 years ago
parent 43d00d645f
commit 465b820326

@ -127,7 +127,53 @@ void sandbox_free(struct sandbox *sandbox);
void sandbox_free_linear_memory(struct sandbox *sandbox); void sandbox_free_linear_memory(struct sandbox *sandbox);
void sandbox_main(struct sandbox *sandbox); void sandbox_main(struct sandbox *sandbox);
int sandbox_parse_http_request(struct sandbox *sandbox, size_t length); int sandbox_parse_http_request(struct sandbox *sandbox, size_t length);
char * sandbox_state_stringify(sandbox_state_t sandbox_state);
static inline char *
sandbox_state_stringify(sandbox_state_t state)
{
switch (state) {
case SANDBOX_UNINITIALIZED:
return "Uninitialized";
case SANDBOX_ALLOCATED:
return "Allocated";
case SANDBOX_SET_AS_INITIALIZED:
return "Set As Initialized";
case SANDBOX_INITIALIZED:
return "Initialized";
case SANDBOX_SET_AS_RUNNABLE:
return "Set As Runnable";
case SANDBOX_RUNNABLE:
return "Runnable";
case SANDBOX_SET_AS_RUNNING:
return "Set As Running";
case SANDBOX_RUNNING:
return "Running";
case SANDBOX_SET_AS_PREEMPTED:
return "Set As Preempted";
case SANDBOX_PREEMPTED:
return "Preempted";
case SANDBOX_SET_AS_BLOCKED:
return "Set As Blocked";
case SANDBOX_BLOCKED:
return "Blocked";
case SANDBOX_SET_AS_RETURNED:
return "Set As Returned";
case SANDBOX_RETURNED:
return "Returned";
case SANDBOX_SET_AS_COMPLETE:
return "Set As Complete";
case SANDBOX_COMPLETE:
return "Complete";
case SANDBOX_SET_AS_ERROR:
return "Set As Error";
case SANDBOX_ERROR:
return "Error";
default:
/* Crash, as this should be exclusive */
assert(0);
}
}
/** /**
* Given a sandbox, returns the module that sandbox is executing * Given a sandbox, returns the module that sandbox is executing

@ -275,52 +275,6 @@ sandbox_initialize_io_handles_and_file_descriptors(struct sandbox *sandbox)
assert(f == 2); assert(f == 2);
} }
char *
sandbox_state_stringify(sandbox_state_t state)
{
switch (state) {
case SANDBOX_UNINITIALIZED:
return "Uninitialized";
case SANDBOX_ALLOCATED:
return "Allocated";
case SANDBOX_SET_AS_INITIALIZED:
return "Set As Initialized";
case SANDBOX_INITIALIZED:
return "Initialized";
case SANDBOX_SET_AS_RUNNABLE:
return "Set As Runnable";
case SANDBOX_RUNNABLE:
return "Runnable";
case SANDBOX_SET_AS_RUNNING:
return "Set As Running";
case SANDBOX_RUNNING:
return "Running";
case SANDBOX_SET_AS_PREEMPTED:
return "Set As Preempted";
case SANDBOX_PREEMPTED:
return "Preempted";
case SANDBOX_SET_AS_BLOCKED:
return "Set As Blocked";
case SANDBOX_BLOCKED:
return "Blocked";
case SANDBOX_SET_AS_RETURNED:
return "Set As Returned";
case SANDBOX_RETURNED:
return "Returned";
case SANDBOX_SET_AS_COMPLETE:
return "Set As Complete";
case SANDBOX_COMPLETE:
return "Complete";
case SANDBOX_SET_AS_ERROR:
return "Set As Error";
case SANDBOX_ERROR:
return "Error";
default:
/* Crash, as this should be exclusive */
assert(0);
}
}
/** /**
* Sandbox execution logic * Sandbox execution logic
* Handles setup, request parsing, WebAssembly initialization, function execution, response building and sending, and * Handles setup, request parsing, WebAssembly initialization, function execution, response building and sending, and

Loading…
Cancel
Save