Index: ossp-pkg/ex/ex.h RCS File: /v/ossp/cvs/ossp-pkg/ex/ex.h,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/ex/ex.h,v' 2>/dev/null --- ex.h 2002/01/25 18:31:07 1.2 +++ ex.h 2002/01/25 18:36:17 1.3 @@ -49,7 +49,7 @@ #define __ex_mctx_st struct { jmp_buf jb; } #endif #ifndef __ex_mctx_save -#define __ex_mctx_save(mctx) setjmp((mctx)->jb) +#define __ex_mctx_save(mctx) (setjmp((mctx)->jb) == 0) #endif #ifndef __ex_mctx_restore #define __ex_mctx_restore(mctx) (void)longjmp((mctx)->jb, 1) @@ -74,14 +74,18 @@ /* declare the exception context type (private) */ typedef struct { __ex_mctx_t *ctx_mctx_prev; /* previous jump buffer */ - int ctx_caught; /* flag whether exception was caught */ - volatile ex_t ctx_ex; /* the exception temporary storage */ + int ctx_caught; /* flag whether exception was caught */ + volatile ex_t ctx_ex; /* the exception temporary storage */ } ex_ctx_t; -/* ex context (default requires linking against libex) */ +/* exception context */ #ifndef __ex_ctx #define __ex_ctx (&__ex_ctx_global) -extern ex_ctx_t __ex_ctx_global; +#ifdef __EX_STATIC_CTX__ +static ex_ctx_t __ex_ctx_global; /* for very small environments */ +#else +extern ex_ctx_t __ex_ctx_global; /* for non-MT environments (require libex.a) */ +#endif #endif /* block for trying execution */ @@ -91,7 +95,7 @@ __ex_mctx_t __ex_mctx_me; \ __ex_mctx_prev = __ex_ctx->ctx_mctx_prev; \ __ex_ctx->ctx_mctx_prev = &__ex_mctx_me; \ - if (__ex_mctx_save(&__ex_mctx_me) == 0) { \ + if (__ex_mctx_save(&__ex_mctx_me)) { \ if (1) /* block for catching an exception */