aboutsummaryrefslogtreecommitdiffstats
path: root/coroutine
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-07-19 15:55:34 +1200
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-07-19 15:55:34 +1200
commite14f5762c532241706ad5bd8f81b520c46d97654 (patch)
tree6a6ad06d56582885d99db76d54e608340832cb1d /coroutine
parentdd0e33f0839124a910f4eb0bb67423e041036645 (diff)
downloadruby-e14f5762c532241706ad5bd8f81b520c46d97654.tar.gz
Add assertions to `coroutine_initialize_main`.
Diffstat (limited to 'coroutine')
-rw-r--r--coroutine/copy/Context.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/coroutine/copy/Context.h b/coroutine/copy/Context.h
index 03ee80f0ec..1319f55d16 100644
--- a/coroutine/copy/Context.h
+++ b/coroutine/copy/Context.h
@@ -46,6 +46,9 @@ COROUTINE coroutine_restore_stack(struct coroutine_context *context);
// @param size The size of the private stack area.
// @param base A stack pointer to the base of the main stack. On x86 hardware, this is the upper extent of the region that will be copied to the private stack.
static inline void coroutine_initialize_main(struct coroutine_context *context, void *stack, size_t size, void *base) {
+ assert(stack);
+ assert(size >= 1024);
+
context->stack = stack;
context->size = size;
context->used = 0;
@@ -65,8 +68,6 @@ static inline void coroutine_initialize(
void *base
) {
assert(start);
- assert(stack);
- assert(size >= 1024);
coroutine_initialize_main(context, stack, size, base);