OSSP CVS Repository

ossp - Check-in [1640]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1640
Date: 2002-Jan-25 19:36:17 (local)
2002-Jan-25 18:36:17 (UTC)
User:rse
Branch:
Comment: cleanups
Tickets:
Inspections:
Files:
ossp-pkg/ex/ex.h      1.2 -> 1.3     10 inserted, 6 deleted

ossp-pkg/ex/ex.h 1.2 -> 1.3

--- 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 */

CVSTrac 2.0.1