forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7ca37fb
committed
Use setenv() in preference to putenv().
Since at least 2001 we've used putenv() and avoided setenv(), on thegrounds that the latter was unportable and not in POSIX. However,POSIX added it that same year, and by now the situation has reversed:setenv() is probably more portable than putenv(), since POSIX nowtreats the latter as not being a core function. And setenv() hascleaner semantics too. So, let's reverse that old policy.This commit adds a simple src/port/ implementation of setenv() forany stragglers (we have one in the buildfarm, but I'd not be surprisedif that code is never used in the field). More importantly, extendwin32env.c to also support setenv(). Then, replace usages of putenv()with setenv(), and get rid of some ad-hoc implementations of setenv()wannabees.Also, adjust our src/port/ implementation of unsetenv() to follow thePOSIX spec that it returns an error indicator, rather than returningvoid as per the ancient BSD convention. I don't feel a need to makeall the call sites check for errors, but the portability stub oughtto match real-world practice.Discussion:https://postgr.es/m/2065122.1609212051@sss.pgh.pa.us1 parent62097a4 commit7ca37fb
File tree
26 files changed
+234
-199
lines changed- contrib/dblink
- input
- output
- src
- backend/utils/adt
- bin
- initdb
- pg_ctl
- pg_upgrade
- psql
- common
- include
- port
- interfaces/ecpg/test
- port
- test
- isolation
- regress
- tools/msvc
26 files changed
+234
-199
lines changedLines changed: 18 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15959 | 15959 |
| |
15960 | 15960 |
| |
15961 | 15961 |
| |
| 15962 | + | |
| 15963 | + | |
| 15964 | + | |
15962 | 15965 |
| |
15963 | 15966 |
| |
| 15967 | + | |
15964 | 15968 |
| |
15965 | 15969 |
| |
15966 | 15970 |
| |
15967 |
| - | |
| 15971 | + | |
| 15972 | + | |
| 15973 | + | |
| 15974 | + | |
| 15975 | + | |
| 15976 | + | |
| 15977 | + | |
| 15978 | + | |
| 15979 | + | |
| 15980 | + | |
| 15981 | + | |
| 15982 | + | |
| 15983 | + | |
| 15984 | + | |
15968 | 15985 |
| |
15969 | 15986 |
| |
15970 | 15987 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1757 | 1757 |
| |
1758 | 1758 |
| |
1759 | 1759 |
| |
| 1760 | + | |
1760 | 1761 |
| |
| 1762 | + | |
1761 | 1763 |
| |
1762 | 1764 |
| |
1763 | 1765 |
| |
1764 |
| - | |
| 1766 | + | |
1765 | 1767 |
| |
1766 | 1768 |
| |
1767 | 1769 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 |
| - | |
| 3 | + | |
4 | 4 |
| |
5 |
| - | |
| 5 | + | |
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
14 |
| - | |
| 14 | + |
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
| 2 | + | |
3 | 3 |
| |
4 |
| - | |
| 4 | + | |
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + |
Lines changed: 3 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 |
| - | |
121 |
| - | |
122 | 108 |
| |
123 | 109 |
| |
124 | 110 |
| |
| |||
163 | 149 |
| |
164 | 150 |
| |
165 | 151 |
| |
166 |
| - | |
167 | 152 |
| |
168 | 153 |
| |
169 | 154 |
| |
| |||
199 | 184 |
| |
200 | 185 |
| |
201 | 186 |
| |
202 |
| - | |
| 187 | + | |
203 | 188 |
| |
204 | 189 |
| |
205 | 190 |
| |
| |||
216 | 201 |
| |
217 | 202 |
| |
218 | 203 |
| |
219 |
| - | |
220 | 204 |
| |
221 | 205 |
| |
222 | 206 |
| |
223 |
| - | |
224 | 207 |
| |
225 | 208 |
| |
226 | 209 |
| |
227 | 210 |
| |
228 |
| - | |
229 | 211 |
| |
230 | 212 |
| |
231 | 213 |
| |
| |||
236 | 218 |
| |
237 | 219 |
| |
238 | 220 |
| |
239 |
| - | |
240 | 221 |
| |
241 | 222 |
| |
242 | 223 |
| |
243 |
| - | |
244 | 224 |
| |
245 | 225 |
| |
246 | 226 |
| |
247 |
| - | |
248 | 227 |
| |
249 | 228 |
| |
250 | 229 |
| |
251 |
| - | |
252 |
| - | |
253 |
| - | |
| 230 | + | |
254 | 231 |
| |
255 | 232 |
| |
256 |
| - | |
257 |
| - | |
258 |
| - | |
| 233 | + | |
259 | 234 |
| |
260 | 235 |
| |
261 | 236 |
| |
|
Lines changed: 6 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2355 | 2355 |
| |
2356 | 2356 |
| |
2357 | 2357 |
| |
2358 |
| - | |
2359 |
| - | |
| 2358 | + | |
2360 | 2359 |
| |
2361 | 2360 |
| |
2362 | 2361 |
| |
| |||
2386 | 2385 |
| |
2387 | 2386 |
| |
2388 | 2387 |
| |
2389 |
| - | |
2390 |
| - | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
2391 | 2393 |
| |
2392 | 2394 |
| |
2393 | 2395 |
| |
|
Lines changed: 5 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
889 | 889 |
| |
890 | 890 |
| |
891 | 891 |
| |
892 |
| - | |
| 892 | + | |
893 | 893 |
| |
894 |
| - | |
895 |
| - | |
896 |
| - | |
| 894 | + | |
| 895 | + | |
897 | 896 |
| |
898 | 897 |
| |
899 | 898 |
| |
| |||
2340 | 2339 |
| |
2341 | 2340 |
| |
2342 | 2341 |
| |
2343 |
| - | |
2344 | 2342 |
| |
2345 | 2343 |
| |
2346 | 2344 |
| |
2347 |
| - | |
2348 |
| - | |
| 2345 | + | |
2349 | 2346 |
| |
2350 | 2347 |
| |
2351 | 2348 |
| |
2352 | 2349 |
| |
2353 | 2350 |
| |
2354 | 2351 |
| |
2355 | 2352 |
| |
| 2353 | + | |
2356 | 2354 |
| |
2357 | 2355 |
| |
2358 | 2356 |
| |
|
Lines changed: 34 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
97 | 97 |
| |
98 | 98 |
| |
99 | 99 |
| |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
105 | 105 |
| |
106 |
| - | |
| 106 | + | |
107 | 107 |
| |
108 | 108 |
| |
109 |
| - | |
| 109 | + | |
110 | 110 |
| |
111 |
| - | |
112 |
| - | |
113 |
| - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
114 | 114 |
| |
115 | 115 |
| |
116 | 116 |
| |
| |||
490 | 490 |
| |
491 | 491 |
| |
492 | 492 |
| |
493 |
| - | |
| 493 | + | |
| 494 | + | |
494 | 495 |
| |
495 |
| - | |
496 |
| - | |
497 |
| - | |
498 |
| - | |
499 |
| - | |
500 |
| - | |
501 |
| - | |
502 |
| - | |
503 |
| - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
504 | 518 |
| |
505 | 519 |
| |
506 | 520 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
193 | 193 |
| |
194 | 194 |
| |
195 | 195 |
| |
196 |
| - | |
| 196 | + | |
197 | 197 |
| |
198 | 198 |
| |
199 | 199 |
| |
| |||
245 | 245 |
| |
246 | 246 |
| |
247 | 247 |
| |
248 |
| - | |
| 248 | + | |
249 | 249 |
| |
250 | 250 |
| |
251 | 251 |
| |
252 |
| - | |
| 252 | + | |
253 | 253 |
| |
254 | 254 |
| |
255 | 255 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
436 | 436 |
| |
437 | 437 |
| |
438 | 438 |
| |
439 |
| - | |
440 | 439 |
| |
441 | 440 |
| |
442 | 441 |
| |
|
Lines changed: 0 additions & 36 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
241 | 241 |
| |
242 | 242 |
| |
243 | 243 |
| |
244 |
| - | |
245 |
| - | |
246 |
| - | |
247 |
| - | |
248 |
| - | |
249 |
| - | |
250 |
| - | |
251 |
| - | |
252 |
| - | |
253 |
| - | |
254 |
| - | |
255 |
| - | |
256 |
| - | |
257 |
| - | |
258 |
| - | |
259 |
| - | |
260 |
| - | |
261 |
| - | |
262 |
| - | |
263 |
| - | |
264 |
| - | |
265 |
| - | |
266 |
| - | |
267 |
| - | |
268 |
| - | |
269 |
| - | |
270 |
| - | |
271 |
| - | |
272 |
| - | |
273 |
| - | |
274 |
| - | |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
279 |
| - |
Lines changed: 1 addition & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2296 | 2296 |
| |
2297 | 2297 |
| |
2298 | 2298 |
| |
2299 |
| - | |
2300 |
| - | |
2301 |
| - | |
2302 |
| - | |
| 2299 | + | |
2303 | 2300 |
| |
2304 |
| - | |
2305 |
| - | |
2306 |
| - | |
2307 |
| - | |
2308 |
| - | |
2309 |
| - | |
2310 | 2301 |
| |
2311 | 2302 |
| |
2312 | 2303 |
| |
|
0 commit comments
Comments
(0)