bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] memset_explicit: port to older MS-Windows


From: Paul Eggert
Subject: [PATCH] memset_explicit: port to older MS-Windows
Date: Sat, 17 Dec 2022 23:47:29 -0800

* lib/memset_explicit.c (memset_explicit):
Remove special case for C==0 and MS-Windows.  The code isn’t
needed for correctness and it’s more trouble than it’s worth as it
prevents this module from being used with GNU Emacs, which wants
to port to MS-Windows versions so old that they lack
SecureZeroMemory.
---
 ChangeLog             | 10 ++++++++++
 lib/memset_explicit.c |  9 ---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 997faec27e..d7f0a62ed9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-12-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       memset_explicit: port to older MS-Windows
+       * lib/memset_explicit.c (memset_explicit):
+       Remove special case for C==0 and MS-Windows.  The code isn’t
+       needed for correctness and it’s more trouble than it’s worth as it
+       prevents this module from being used with GNU Emacs, which wants
+       to port to MS-Windows versions so old that they lack
+       SecureZeroMemory.
+
 2022-12-09  Bruno Haible  <bruno@clisp.org>
 
        Update users.txt.
diff --git a/lib/memset_explicit.c b/lib/memset_explicit.c
index 867391b80f..eabeb3ec2b 100644
--- a/lib/memset_explicit.c
+++ b/lib/memset_explicit.c
@@ -23,20 +23,11 @@
 
 #include <string.h>
 
-#if defined _WIN32 && !defined __CYGWIN__
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#endif
-
 /* Set S's bytes to C, where S has LEN bytes.  The compiler will not
    optimize effects away, even if S is dead after the call.  */
 void *
 memset_explicit (void *s, int c, size_t len)
 {
-#if defined _WIN32 && !defined __CYGWIN__
-  if (!c)
-    return SecureZeroMemory (s, len);
-#endif
 #if HAVE_EXPLICIT_MEMSET
   return explicit_memset (s, c, len);
 #elif HAVE_MEMSET_S
-- 
2.38.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]