Sfoglia il codice sorgente

NCDModule: port to DebugError

ambrop7 15 anni fa
parent
commit
5a34d9b18a
2 ha cambiato i file con 5 aggiunte e 19 eliminazioni
  1. 3 16
      ncd/NCDModule.c
  2. 2 3
      ncd/NCDModule.h

+ 3 - 16
ncd/NCDModule.c

@@ -94,9 +94,7 @@ int NCDModuleInst_Init (NCDModuleInst *n, const char *name, const struct NCDModu
     }
     
     DebugObject_Init(&n->d_obj);
-    #ifndef NDEBUG
-    DEAD_INIT(n->d_dead);
-    #endif
+    DebugError_Init(&n->d_err);
     
     return 1;
     
@@ -108,9 +106,7 @@ fail1:
 
 void NCDModuleInst_Free (NCDModuleInst *n)
 {
-    #ifndef NDEBUG
-    DEAD_KILL(n->d_dead);
-    #endif
+    DebugError_Free(&n->d_err);
     DebugObject_Free(&n->d_obj);
     
     // free backend
@@ -189,16 +185,7 @@ void NCDModuleInst_Backend_Died (NCDModuleInst *n, int is_error)
 {
     ASSERT(is_error == 0 || is_error == 1)
     
-    #ifndef NDEBUG
-    DEAD_ENTER(n->d_dead)
-    #endif
-    
-    n->handler_died(n->user, is_error);
-    
-    #ifndef NDEBUG
-    ASSERT(DEAD_KILLED)
-    DEAD_LEAVE(n->d_dead);
-    #endif
+    DEBUGERROR(&n->d_err, n->handler_died(n->user, is_error))
 }
 
 void NCDModuleInst_Backend_Log (NCDModuleInst *n, int channel, int level, const char *fmt, ...)

+ 2 - 3
ncd/NCDModule.h

@@ -25,6 +25,7 @@
 
 #include <stdarg.h>
 
+#include <misc/debugerror.h>
 #include <system/BReactor.h>
 #include <system/BProcess.h>
 #include <system/BPending.h>
@@ -61,9 +62,7 @@ typedef struct {
     int state;
     void *inst_user;
     DebugObject d_obj;
-    #ifndef NDEBUG
-    dead_t d_dead;
-    #endif
+    DebugError d_err;
 } NCDModuleInst;
 
 int NCDModuleInst_Init (NCDModuleInst *n, const char *name, const struct NCDModule *m, NCDValue *args, const char *logprefix, BReactor *reactor, BProcessManager *manager,