Skip to content

Commit 71f5dc6

Browse files
committed
Remove dead setenv, unsetenv replacement code.
setenv() and unsetenv() are in SUSv3 and targeted Unix systems have them. We still need special code for these on Windows, but that doesn't require a configure probe. This marks the first time we require a SUSv3 (POSIX.1-2001) facility (rather than SUSv2). The replacement code removed here was not needed on any targeted system or any known non-EOL'd Unix system, and was therefore dead and untested. No need for vestigial HAVE_SETENV and HAVE_UNSETENV macros, because we provide a replacement for Windows, and we didn't previously test the macros. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Greg Stark <stark@mit.edu> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
1 parent b79ec73 commit 71f5dc6

File tree

7 files changed

+0
-185
lines changed

7 files changed

+0
-185
lines changed

configure

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16841,49 +16841,6 @@ esac
1684116841
$as_echo "$as_me: On $host_os we will use our strtof wrapper." >&6;}
1684216842
fi
1684316843

16844-
case $host_os in
16845-
# Windows uses a specialised env handler
16846-
mingw*)
16847-
16848-
$as_echo "#define HAVE_SETENV 1" >>confdefs.h
16849-
16850-
16851-
$as_echo "#define HAVE_UNSETENV 1" >>confdefs.h
16852-
16853-
ac_cv_func_setenv=yes
16854-
ac_cv_func_unsetenv=yes
16855-
;;
16856-
*)
16857-
ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv"
16858-
if test "x$ac_cv_func_setenv" = xyes; then :
16859-
$as_echo "#define HAVE_SETENV 1" >>confdefs.h
16860-
16861-
else
16862-
case " $LIBOBJS " in
16863-
*" setenv.$ac_objext "* ) ;;
16864-
*) LIBOBJS="$LIBOBJS setenv.$ac_objext"
16865-
;;
16866-
esac
16867-
16868-
fi
16869-
16870-
ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv"
16871-
if test "x$ac_cv_func_unsetenv" = xyes; then :
16872-
$as_echo "#define HAVE_UNSETENV 1" >>confdefs.h
16873-
16874-
else
16875-
case " $LIBOBJS " in
16876-
*" unsetenv.$ac_objext "* ) ;;
16877-
*) LIBOBJS="$LIBOBJS unsetenv.$ac_objext"
16878-
;;
16879-
esac
16880-
16881-
fi
16882-
16883-
16884-
;;
16885-
esac
16886-
1688716844
# System's version of getaddrinfo(), if any, may be used only if we found
1688816845
# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h.
1688916846
# We use only our own getaddrinfo.c on Windows, but it's time to revisit that.

configure.ac

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,19 +1898,6 @@ if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then
18981898
AC_MSG_NOTICE([On $host_os we will use our strtof wrapper.])
18991899
fi
19001900

1901-
case $host_os in
1902-
# Windows uses a specialised env handler
1903-
mingw*)
1904-
AC_DEFINE(HAVE_SETENV, 1, [Define to 1 because replacement version used.])
1905-
AC_DEFINE(HAVE_UNSETENV, 1, [Define to 1 because replacement version used.])
1906-
ac_cv_func_setenv=yes
1907-
ac_cv_func_unsetenv=yes
1908-
;;
1909-
*)
1910-
AC_REPLACE_FUNCS([setenv unsetenv])
1911-
;;
1912-
esac
1913-
19141901
# System's version of getaddrinfo(), if any, may be used only if we found
19151902
# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h.
19161903
# We use only our own getaddrinfo.c on Windows, but it's time to revisit that.

src/include/pg_config.h.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,6 @@
448448
/* Define to 1 if you have the <security/pam_appl.h> header file. */
449449
#undef HAVE_SECURITY_PAM_APPL_H
450450

451-
/* Define to 1 if you have the `setenv' function. */
452-
#undef HAVE_SETENV
453-
454451
/* Define to 1 if you have the `setproctitle' function. */
455452
#undef HAVE_SETPROCTITLE
456453

@@ -625,9 +622,6 @@
625622
/* Define to 1 if you have the <unistd.h> header file. */
626623
#undef HAVE_UNISTD_H
627624

628-
/* Define to 1 if you have the `unsetenv' function. */
629-
#undef HAVE_UNSETENV
630-
631625
/* Define to 1 if you have the `uselocale' function. */
632626
#undef HAVE_USELOCALE
633627

src/include/port.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,6 @@ extern size_t strlcpy(char *dst, const char *src, size_t siz);
448448
extern size_t strnlen(const char *str, size_t maxlen);
449449
#endif
450450

451-
#ifndef HAVE_SETENV
452-
extern int setenv(const char *name, const char *value, int overwrite);
453-
#endif
454-
455-
#ifndef HAVE_UNSETENV
456-
extern int unsetenv(const char *name);
457-
#endif
458-
459451
/* thread.c */
460452
#ifndef WIN32
461453
extern bool pg_get_user_name(uid_t user_id, char *buffer, size_t buflen);

src/port/setenv.c

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/port/unsetenv.c

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/tools/msvc/Solution.pm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ sub GenerateFiles
343343
HAVE_RL_RESET_SCREEN_SIZE => undef,
344344
HAVE_RL_VARIABLE_BIND => undef,
345345
HAVE_SECURITY_PAM_APPL_H => undef,
346-
HAVE_SETENV => undef,
347346
HAVE_SETPROCTITLE => undef,
348347
HAVE_SETPROCTITLE_FAST => undef,
349348
HAVE_SOCKLEN_T => 1,
@@ -402,7 +401,6 @@ sub GenerateFiles
402401
HAVE_UINT8 => undef,
403402
HAVE_UNION_SEMUN => undef,
404403
HAVE_UNISTD_H => 1,
405-
HAVE_UNSETENV => undef,
406404
HAVE_USELOCALE => undef,
407405
HAVE_UUID_BSD => undef,
408406
HAVE_UUID_E2FS => undef,

0 commit comments

Comments
 (0)