[hipl-commit] [tiny] Rev 3695: Removed dependeny from lmod.c to lib/core/debug.h

  • From: Tim Just <tim.just@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Thu, 18 Mar 2010 18:06:50 +0200

Committer: Tim Just <tim.just@xxxxxxxxxxxxxx>
Date: 18/03/2010 at 18:06:50
Revision: 3695
Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: tiny

Log:
  Removed dependeny from lmod.c to lib/core/debug.h
  
  The modularization lib should not have any dependencies to HIPL. The sole
  exception is the linked list implementation. There is no reasons for
  adding another linked list implementation to HIPL.

Modified:
  M  lib/modularization/lmod.c

=== modified file 'lib/modularization/lmod.c'
--- lib/modularization/lmod.c   2010-03-18 15:36:44 +0000
+++ lib/modularization/lmod.c   2010-03-18 15:44:13 +0000
@@ -12,7 +12,6 @@
 #include <string.h>
 
 #include "lmod.h"
-#include "lib/core/debug.h"
 
 /**
  * A generic struct for function pointer.
@@ -76,12 +75,10 @@
     struct modular_state *state;
 
     if (!(state = malloc(sizeof(struct modular_state)))) {
-        HIP_ERROR("Error on allocating memory for a modular_state 
instance.\n");
         return NULL;
     }
 
     if (!(state->item_list = malloc(sizeof(hip_ll_t)))) {
-        HIP_ERROR("Error on allocating memory for a linked list.\n");
         return NULL;
     }
 
@@ -108,19 +105,22 @@
     int err = 0;
     hip_ll_t *new_func_list = NULL;
 
-    HIP_IFEL(!func, -1, "Invalid init function provided");
+    if (!func) {
+        return -1;
+    }
 
     if (!state_init_functions) {
-        HIP_IFEL(!(new_func_list = malloc(sizeof(hip_ll_t))),
-                 -1,
-                 "Error on allocating memory for a linked list.\n");
+
+        if (!(new_func_list = malloc(sizeof(hip_ll_t)))) {
+            return -1;
+        }
+
         hip_ll_init(new_func_list);
         state_init_functions = new_func_list;
     }
 
     err = hip_ll_add_last(state_init_functions, func);
 
-out_err:
     return err;
 }

Other related posts:

  • » [hipl-commit] [tiny] Rev 3695: Removed dependeny from lmod.c to lib/core/debug.h - Tim Just