1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/zlib/zlib.c (zlib_mem_alloc): suppress valgrind warnings.

http://www.zlib.net/zlib_faq.html#faq36


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-02-15 13:26:51 +00:00
parent 795b03c71c
commit 8d532a8689
2 changed files with 25 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Mon Feb 15 22:25:16 2010 Tanaka Akira <akr@fsij.org>
* ext/zlib/zlib.c (zlib_mem_alloc): suppress valgrind warnings.
http://www.zlib.net/zlib_faq.html#faq36
Mon Feb 15 22:18:49 2010 Tanaka Akira <akr@fsij.org>
* time.c (time_add): propagate fixed time offset.

View file

@ -11,6 +11,19 @@
#include <time.h>
#include <ruby/encoding.h>
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
# ifndef VALGRIND_MAKE_MEM_DEFINED
# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE(p, n)
# endif
# ifndef VALGRIND_MAKE_MEM_UNDEFINED
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE(p, n)
# endif
#else
# define VALGRIND_MAKE_MEM_DEFINED(p, n) /* empty */
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) /* empty */
#endif
#define RUBY_ZLIB_VERSION "0.6.0"
@ -436,7 +449,13 @@ static const struct zstream_funcs inflate_funcs = {
static voidpf
zlib_mem_alloc(voidpf opaque, uInt items, uInt size)
{
return xmalloc(items * size);
voidpf p = xmalloc(items * size);
/* zlib FAQ: Valgrind (or some similar memory access checker) says that
deflate is performing a conditional jump that depends on an
uninitialized value. Isn't that a bug?
http://www.zlib.net/zlib_faq.html#faq36 */
VALGRIND_MAKE_MEM_DEFINED(p, items * size);
return p;
}
static void