summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--include/ruby/missing.h14
-rw-r--r--missing/explicit_bzero.c7
3 files changed, 15 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index c2326d1626..8582d9b641 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun Jan 10 15:45:10 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/missing.h (explicit_bzero_by_memset_s): remove
+ inline implementation by memset_s, which needs a macro before
+ including headers and can cause problems in extension libraries
+ by the order of the macro and headers.
+
Sun Jan 10 13:41:36 2016 Eric Wong <e@80x24.org>
* io.c (rb_deferr): remove long obsolete global
diff --git a/include/ruby/missing.h b/include/ruby/missing.h
index 8db33496ab..97091606b0 100644
--- a/include/ruby/missing.h
+++ b/include/ruby/missing.h
@@ -18,10 +18,6 @@ extern "C" {
#endif
#endif
-#ifndef __STDC_WANT_LIB_EXT1__
-#define __STDC_WANT_LIB_EXT1__ 1
-#endif
-
#include "ruby/config.h"
#include <stddef.h>
#include <math.h> /* for INFINITY and NAN */
@@ -248,15 +244,7 @@ RUBY_EXTERN void setproctitle(const char *fmt, ...);
#ifndef HAVE_EXPLICIT_BZERO
RUBY_EXTERN void explicit_bzero(void *b, size_t len);
-# ifdef HAVE_MEMSET_S
-# include <string.h>
-static inline void
-explicit_bzero_by_memset_s(void *b, size_t len)
-{
- memset_s(b, len, 0, len);
-}
-# define explicit_bzero(b, len) explicit_bzero_by_memset_s(b, len)
-# elif defined SecureZeroMemory
+# if defined SecureZeroMemory
# define explicit_bzero(b, len) SecureZeroMemory(b, len)
# endif
#endif
diff --git a/missing/explicit_bzero.c b/missing/explicit_bzero.c
index 2409deca20..a7ff9cb517 100644
--- a/missing/explicit_bzero.c
+++ b/missing/explicit_bzero.c
@@ -1,5 +1,12 @@
+#ifndef __STDC_WANT_LIB_EXT1__
+#define __STDC_WANT_LIB_EXT1__ 1
+#endif
+
#include "ruby/missing.h"
#include <string.h>
+#ifdef HAVE_MEMSET_S
+# include <string.h>
+#endif
#ifdef _WIN32
#include <windows.h>