mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (rb_big_realloc): Use VALGRIND_MAKE_MEM_UNDEFINED to
declare undefined memory area. (bignew_1): Ditto. * internal.h (VALGRIND_MAKE_MEM_DEFINED): Moved from gc.c (VALGRIND_MAKE_MEM_UNDEFINED): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0bd6f36aa7
commit
25336fa7c1
4 changed files with 24 additions and 13 deletions
|
@ -1,3 +1,12 @@
|
|||
Tue Aug 6 12:23:12 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (rb_big_realloc): Use VALGRIND_MAKE_MEM_UNDEFINED to
|
||||
declare undefined memory area.
|
||||
(bignew_1): Ditto.
|
||||
|
||||
* internal.h (VALGRIND_MAKE_MEM_DEFINED): Moved from gc.c
|
||||
(VALGRIND_MAKE_MEM_UNDEFINED): Ditto.
|
||||
|
||||
Tue Aug 6 01:40:37 2013 Zachary Scott <e@zzak.io>
|
||||
|
||||
* process.c: [DOC] Document caveats of command form of Process.spawn
|
||||
|
|
2
bignum.c
2
bignum.c
|
@ -2886,6 +2886,7 @@ rb_big_realloc(VALUE big, long len)
|
|||
ds = RBIGNUM(big)->as.heap.digits;
|
||||
RBASIC(big)->flags |= RBIGNUM_EMBED_FLAG;
|
||||
RBIGNUM_SET_LEN(big, len);
|
||||
(void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, sizeof(RBIGNUM(big)->as.ary));
|
||||
if (ds) {
|
||||
MEMCPY(RBIGNUM(big)->as.ary, ds, BDIGIT, len);
|
||||
xfree(ds);
|
||||
|
@ -2917,6 +2918,7 @@ bignew_1(VALUE klass, long len, int sign)
|
|||
if (len <= RBIGNUM_EMBED_LEN_MAX) {
|
||||
RBASIC(big)->flags |= RBIGNUM_EMBED_FLAG;
|
||||
RBIGNUM_SET_LEN(big, len);
|
||||
(void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, sizeof(RBIGNUM(big)->as.ary));
|
||||
}
|
||||
else {
|
||||
RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len);
|
||||
|
|
13
gc.c
13
gc.c
|
@ -52,19 +52,6 @@
|
|||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#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) 0
|
||||
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
|
||||
#endif
|
||||
|
||||
#define rb_setjmp(env) RUBY_SETJMP(env)
|
||||
#define rb_jmp_buf rb_jmpbuf_t
|
||||
|
||||
|
|
13
internal.h
13
internal.h
|
@ -19,6 +19,19 @@ extern "C" {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#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) 0
|
||||
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
|
||||
#endif
|
||||
|
||||
#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
|
||||
|
||||
#define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
|
||||
|
|
Loading…
Reference in a new issue