added doxygen comments
[libfirm] / ir / ir / irreflect.c
index ad211f6..a567e37 100644 (file)
@@ -6,14 +6,21 @@
  *
  * $Id$
  */
-
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-
-#define obstack_chunk_alloc malloc
-#define obstack_chunk_free free
-#include <obstack.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+
+#include "obst.h"
 
 #include "irmode.h"
 #include "irreflect.h"
@@ -72,9 +79,7 @@ static INLINE void assure_opcode_capacity(int opcode)
 {
        if(opcode >= opcodes_size) {
                int new_size = 2 * opcode;
-               rflct_opcode_t **new_opcodes = malloc(sizeof(*new_opcodes) * new_size);
-
-               memset(new_opcodes, 0, sizeof(*new_opcodes) * new_size);
+               rflct_opcode_t **new_opcodes = xcalloc(new_size, sizeof(new_opcodes[0]));
 
                if(opcodes != NULL) {
                        memcpy(new_opcodes, opcodes, sizeof(*opcodes) * opcodes_size);
@@ -428,7 +433,7 @@ bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig)
 
 rflct_sig_t *rflct_signature_allocate(int defs, int uses)
 {
-       rflct_sig_t *sig = malloc(sizeof(*sig));
+       rflct_sig_t *sig = xmalloc(sizeof(*sig));
 
        rflct_arg_t *args =
                obstack_alloc(&obst, sizeof(*args) * (defs + uses + 2));