N
Noob
Hello everyone,
I'm using a library which provides a void *user_data field
inside the struct used everywhere within the library.
I need to stuff a jmp_buf inside user_data.
I suppose I can't write
jmp_buf env;
ctx->user_data = env;
and then use ctx->user_data as setjmp's and longjmp's parameter?
Instead, I'd have to write
jmp_buf env;
ctx->user_data = &env;
and when I need the jmp_buf, I have to write
*(jmp_buf *)ctx->user_data
or
jmp_buf *envp = ctx->user_data;
*envp
Did I get it right?
Is there different way to do this?
Regards.
I'm using a library which provides a void *user_data field
inside the struct used everywhere within the library.
I need to stuff a jmp_buf inside user_data.
I suppose I can't write
jmp_buf env;
ctx->user_data = env;
and then use ctx->user_data as setjmp's and longjmp's parameter?
Instead, I'd have to write
jmp_buf env;
ctx->user_data = &env;
and when I need the jmp_buf, I have to write
*(jmp_buf *)ctx->user_data
or
jmp_buf *envp = ctx->user_data;
*envp
Did I get it right?
Is there different way to do this?
Regards.