Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Fix ph_memory_realloc error if orig_size == size #89

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ esac

# If you're bumping the CK max-version here, you must also bump it in
# travis/deps.sh otherwise you will break the CI build
if ! $PKG_CONFIG --exists --atleast-version=0.5.0 --max-version=0.5.1 --print-errors ck ; then
if ! $PKG_CONFIG --exists --atleast-version=0.5.0 --max-version=0.6.0 --print-errors ck ; then
AC_MSG_ERROR([ck is required])
fi
CFLAGS="$CFLAGS `$PKG_CONFIG --cflags ck`"
Expand Down Expand Up @@ -312,7 +312,7 @@ if test -n "$GCC" ; then
-W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
-Wno-nested-externs -Winline -Wdisabled-optimization \
-fstrict-aliasing -pipe -Wno-parentheses"
-fstrict-aliasing -pipe -Wno-parentheses -Wno-varargs"
fi
AC_SUBST(PC_CFLAGS)
AC_SUBST(PC_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion corelib/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ void *ph_mem_realloc(ph_memtype_t mt, void *ptr, uint64_t size)

hdr = ptr;
hdr--;
ptr = hdr;

if (hdr->mt != mt) {
memory_panic("ph_mem_realloc: hdr->mt %d != caller provided mt %d %s",
Expand All @@ -452,6 +451,7 @@ void *ph_mem_realloc(ph_memtype_t mt, void *ptr, uint64_t size)
return ptr;
}

ptr = hdr;
hdr = realloc(ptr, size + HEADER_RESERVATION);
if (!hdr) {
ph_counter_scope_add(mem_type->scope,
Expand Down
1 change: 1 addition & 0 deletions corelib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ph_string_t *ph_string_make_slice(ph_string_t *str,
}

ph_string_init_slice(slice, str, start, len);
slice->onstack = false;
return slice;
}

Expand Down
2 changes: 2 additions & 0 deletions include/phenom/hashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef PHENOM_HASHTABLE_H
#define PHENOM_HASHTABLE_H

#include "phenom/defs.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 1 addition & 1 deletion travis/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ esac
HERE=$PWD

# There is no CK package available for ubuntu yet
CK_VER=0.5.1
CK_VER=0.6.0
CK_RELEASE=https://github.com/concurrencykit/ck/archive/$CK_VER.tar.gz
if test ! -f $CK_VER.tar.gz ; then
wget $CK_RELEASE
Expand Down