[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
setenv: Modernize
From: |
Bruno Haible |
Subject: |
setenv: Modernize |
Date: |
Thu, 06 Jun 2024 00:00:10 +0200 |
The setenv module's code, shared with glibc, contains an unnecessary
cast from 'char **' to 'char *'. Probably it was once needed for pre-ANSI C
systems, when the type 'void *' did not exist and memcpy() took a 'char *'
as first argument. This is long obsolete.
2024-06-05 Bruno Haible <bruno@clisp.org>
setenv: Modernize.
* lib/setenv.c (__add_to_environ): Remove unnecessary casts.
diff --git a/lib/setenv.c b/lib/setenv.c
index 9e2e9e2f0f..2c26734ea1 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -215,8 +215,7 @@ __add_to_environ (const char *name, const char *value,
const char *combined,
}
if (__environ != last_environ)
- memcpy ((char *) new_environ, (char *) __environ,
- size * sizeof (char *));
+ memcpy (new_environ, __environ, size * sizeof (char *));
new_environ[size + 1] = NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- setenv: Modernize,
Bruno Haible <=