]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix compile warnings in openbsd malloc
authorSebastian Hahn <sebastian@torproject.org>
Thu, 8 Mar 2012 18:27:05 +0000 (19:27 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Thu, 8 Mar 2012 18:28:59 +0000 (19:28 +0100)
changes/bug5340 [new file with mode: 0644]
src/common/OpenBSD_malloc_Linux.c

diff --git a/changes/bug5340 b/changes/bug5340
new file mode 100644 (file)
index 0000000..708988a
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes:
+    - Fix a compile warning when using the --enable-openbsd-malloc configure
+      option. Fixes bug 5340; bugfix on 0.2.0.20-rc.
index 445135c6bba09dbc504bf300ae28917339ac7693..92ca9c00668bf6060c5aed2ed82203cc06e774cc 100644 (file)
@@ -285,6 +285,8 @@ static void *imalloc(size_t size);
 static void    ifree(void *ptr);
 static void    *irealloc(void *ptr, size_t size);
 static void    *malloc_bytes(size_t size);
+void *memalign(size_t boundary, size_t size);
+size_t malloc_good_size(size_t size);
 
 /*
  * Function for page directory lookup.
@@ -1980,10 +1982,11 @@ static int ispowerof2 (size_t a) {
 int posix_memalign(void **memptr, size_t alignment, size_t size)
 {
        void *r;
+       size_t max;
        if ((alignment < PTR_SIZE) || (alignment%PTR_SIZE != 0)) return EINVAL;
        if (!ispowerof2(alignment)) return EINVAL;
        if (alignment < malloc_minsize) alignment = malloc_minsize;
-       size_t max = alignment > size ? alignment : size;
+       max = alignment > size ? alignment : size;
        if (alignment <= malloc_pagesize)
                r = malloc(max);
        else {