Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2022-01-11 18:46:12 +0000
committerTom Lane2022-01-11 18:46:20 +0000
commit98e93a1fc93e9b54eb477d870ec744e9e1669f34 (patch)
tree8d16b420c2b1b49c9c21af5d8fe93c9d1da93e1e /src/bin/psql/common.c
parent7fa945b857cc1b2964799411f1633468826861ff (diff)
Clean up messy API for src/port/thread.c.
The point of this patch is to reduce inclusion spam by not needing to #include <netdb.h> or <pwd.h> in port.h (which is read by every compile in our tree). To do that, we must remove port.h's declarations of pqGetpwuid and pqGethostbyname. pqGethostbyname is only used, and is only ever likely to be used, in src/port/getaddrinfo.c --- which isn't even built on most platforms, making pqGethostbyname dead code for most people. Hence, deal with that by just moving it into getaddrinfo.c. To clean up pqGetpwuid, invent a couple of simple wrapper functions with less-messy APIs. This allows removing some duplicate error-handling code, too. In passing, remove thread.c from the MSVC build, since it contains nothing we use on Windows. Noted while working on 376ce3e40. Discussion: https://postgr.es/m/1634252654444.90107@mit.edu
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r--src/bin/psql/common.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index f210ccbde85..3503605a7d1 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -10,6 +10,7 @@
#include <ctype.h>
#include <limits.h>
#include <math.h>
+#include <pwd.h>
#include <signal.h>
#ifndef WIN32
#include <unistd.h> /* for write() */