static struct local_error *error_context() { struct local_error *context = (struct local_error *)local_storage_get(&local_error_key); if (!context) { context = malloc(sizeof(struct local_error)); assert(context); context->is_error = false; local_storage_set(&local_error_key, context); } return context; }
FINI static void _error_fini() { { struct local_error *context = (struct local_error *)local_storage_get(&local_error_key); if (context) { error_delete(context); } } error_is_valid = false; { UNUSED const bool ret = local_storage_destroy(&local_error_key); assert(ret); } }
int thread_getid() { return (ptrdiff_t)local_storage_get(&thread_id_key); }