fix warnings and errors
authorFIRM Projekt Account <firm@ipd.info.uni-karlsruhe.de>
Tue, 4 May 2010 12:39:44 +0000 (12:39 +0000)
committerFIRM Projekt Account <firm@ipd.info.uni-karlsruhe.de>
Tue, 4 May 2010 12:39:44 +0000 (12:39 +0000)
[r27477]

ir/obstack/obstack_printf.c

index ab494bb..836ffa8 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 #include "obstack.h"
 
 #ifdef _WIN32
@@ -11,7 +12,7 @@ int obstack_printf(struct obstack *obst, const char *fmt, ...)
 {
        char    buf[128];
        char   *buffer = buf;
-       size_t  size   = lengthof(buf);
+       size_t  size   = sizeof(buf);
        va_list ap;
        int     len;
 
@@ -37,7 +38,7 @@ int obstack_printf(struct obstack *obst, const char *fmt, ...)
                } else {
                        break;
                }
-               buffer = malloc(buffer, size);
+               buffer = malloc(size);
        }
 
        obstack_grow(obst, buffer, len);