Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make sure that the code still compiles with the freaking paranoid gcc warning options...
[simgrid.git] / src / gras / DataDesc / ddt_create.c
index 2ab1378..6caa963 100644 (file)
@@ -53,22 +53,33 @@ static gras_datadesc_type_t gras_ddt_new(const char *name) {
  */
 gras_datadesc_type_t gras_datadesc_by_name(const char *name) {
   xbt_ex_t e;
-  gras_datadesc_type_t res;
+  gras_datadesc_type_t res = NULL;
   TRY {
     res = (gras_datadesc_type_t)xbt_set_get_by_name(gras_datadesc_set_local,name);
   } CATCH(e) {
-    if (e.category != mismatch_error)
+    if (e.category != not_found_error)
       RETHROW;
+    xbt_ex_free(e);
     res = NULL;
   }
   return res;
 }
 
 /**
- * Retrieve a type from its code
+ * Retrieve a type from its code (or NULL if not found)
  */
 gras_datadesc_type_t gras_datadesc_by_id(long int code) {
-  return (gras_datadesc_type_t)xbt_set_get_by_id(gras_datadesc_set_local,code);
+  xbt_ex_t e;
+  gras_datadesc_type_t res=NULL;
+  TRY {
+    res = (gras_datadesc_type_t)xbt_set_get_by_id(gras_datadesc_set_local,code);
+  } CATCH(e) {
+    if (e.category != not_found_error)
+      RETHROW;
+    xbt_ex_free(e);
+    res = NULL;
+  }
+  return res;
 }
 
 /**
@@ -616,11 +627,11 @@ gras_datadesc_dynar(gras_datadesc_type_t elm_t,
   return res;
 }
 
-xbt_error_t
+
+gras_datadesc_type_t
 gras_datadesc_import_nws(const char           *name,
                         const DataDescriptor *desc,
-                        unsigned long         howmany,
-              /* OUT */ gras_datadesc_type_t *dst) {
+                        unsigned long         howmany) {
   THROW_UNIMPLEMENTED;
 }