fixed indentation
[libfirm] / ir / common / firm_common.c
index bcd54f6..0c9ec8d 100644 (file)
 
 
 #ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
 #endif
 
 #include "firm_common_t.h"
 #include "irgraph.h"
+#include "irloop.h"
+
+/**
+ * Ideally, this macro would check if size bytes could be read at
+ * pointer p. No generic solution.
+ */
+#define POINTER_READ(p, size) (p)
 
 /* returns the kind of the thing */
 firm_kind
 get_kind (const void *firm_thing) {
-  assert (firm_thing);
-  return *(firm_kind *)firm_thing;
+  return POINTER_READ(firm_thing, sizeof(firm_kind)) ? *(firm_kind *)firm_thing : k_BAD;
 }
 
 
@@ -67,7 +73,7 @@ void firm_identify_thing(void *X)
     printf("type: %s %s: %ld (%p)\n", get_type_tpop_name(X), get_type_name(X), get_type_nr(X), X);
     break;
   case k_ir_graph:
-    printf("graph: %s: %ld (%p)\n", get_entity_name(get_irg_ent(X)), get_irg_graph_nr(X), X);
+    printf("graph: %s: %ld (%p)\n", get_entity_name(get_irg_entity(X)), get_irg_graph_nr(X), X);
     break;
   case k_ir_node:
     printf("irnode: %s%s %ld (%p)\n", get_irn_opname(X), get_mode_name(get_irn_mode(X)), get_irn_node_nr(X), X);