From 3c35702fe921254340ad949ce3cab0b668788c90 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 20 Jan 2014 08:47:41 -0800 Subject: [PATCH] Pacify valgrind by initializing buffer redisplay bit. Problem reported by Dmitry Antipov in . * alloc.c (USE_VALGRIND): Move this to ... * conf_post.h (USE_VALGRIND): ... here. Use booleans. * buffer.c (Fget_buffer_create): Initialize redisplay bit to pacify valgrind. --- src/ChangeLog | 8 ++++++++ src/alloc.c | 6 ------ src/buffer.c | 4 +++- src/conf_post.h | 9 +++++++++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 87b84e00918..3ac22572d2f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2014-01-20 Paul Eggert + Pacify valgrind by initializing buffer redisplay bit. + Problem reported by Dmitry Antipov in + . + * alloc.c (USE_VALGRIND): Move this to ... + * conf_post.h (USE_VALGRIND): ... here. Use booleans. + * buffer.c (Fget_buffer_create): Initialize redisplay bit + to pacify valgrind. + Revert some of the CANNOT_DUMP fix (Bug#16494). * lread.c (init_lread): Fix typo: NILP, not !NILP. diff --git a/src/alloc.c b/src/alloc.c index 7f0a74ca834..d31cf3b7193 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -48,12 +48,6 @@ along with GNU Emacs. If not, see . */ #include -#if (defined ENABLE_CHECKING \ - && defined HAVE_VALGRIND_VALGRIND_H \ - && !defined USE_VALGRIND) -# define USE_VALGRIND 1 -#endif - #if USE_VALGRIND #include #include diff --git a/src/buffer.c b/src/buffer.c index c48610d6578..87405174ad2 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -573,7 +573,9 @@ even if it is dead. The return value is never nil. */) BUF_END_UNCHANGED (b) = 0; BUF_BEG_UNCHANGED (b) = 0; *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */ - b->text->inhibit_shrinking = 0; + b->text->inhibit_shrinking = false; + if (USE_VALGRIND) + b->text->redisplay = false; b->newline_cache = 0; b->width_run_cache = 0; diff --git a/src/conf_post.h b/src/conf_post.h index 7419b53c5df..cdb2f973c2b 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -65,6 +65,15 @@ typedef bool bool_bf; # define ADDRESS_SANITIZER false #endif +/* True if Emacs might be run under valgrind. */ +#ifndef USE_VALGRIND +# if defined ENABLE_CHECKING && defined HAVE_VALGRIND_VALGRIND_H +# define USE_VALGRIND true +# else +# define USE_VALGRIND false +# endif +#endif + #ifdef DARWIN_OS #ifdef emacs #define malloc unexec_malloc -- 2.39.2