]> Savannah Git Hosting - gnulib.git/commitdiff
memset_explicit: port to older MS-Windows
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Dec 2022 07:45:56 +0000 (23:45 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Dec 2022 07:46:43 +0000 (23:46 -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
lib/memset_explicit.c

index 997faec27e81c062ed1fd53491624667fced9855..d7f0a62ed947d5d2bb195b881ff273a512944d6a 100644 (file)
--- 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.
index 867391b80f2b6fa77ff3f94eef947443249a0e98..eabeb3ec2b8d63e1311c72eb0be133496ad3cfaa 100644 (file)
 
 #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