forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8b26769
committed
Fix an assortment of improper usages of string functions
In a similar effort tof736e18 and110d817, fixup various usages ofstring functions where a more appropriate function is available and morefit for purpose.These changes include:1. Use cstring_to_text_with_len() instead of cstring_to_text() when working with a StringInfoData and the length can easily be obtained.2. Use appendStringInfoString() instead of appendStringInfo() when no formatting is required.3. Use pstrdup(...) instead of psprintf("%s", ...)4. Use pstrdup(...) instead of psprintf(...) (with no formatting)5. Use appendPQExpBufferChar() instead of appendPQExpBufferStr() when the length of the string being appended is 1.6. appendStringInfoChar() instead of appendStringInfo() when no formatting is required and string is 1 char long.7. Use appendPQExpBufferStr(b, .) instead of appendPQExpBuffer(b, "%s", .)8. Don't use pstrdup when it's fine to just point to the string constant.I (David) did find other cases ofpostgres#8 but opted to use#4 instead as Iwasn't certain enough that applyingpostgres#8 was ok (e.g in hba.c)Author: Ranier Vilela, David RowleyDiscussion:https://postgr.es/m/CAApHDvo2j2+RJBGhNtUz6BxabWWh2Jx16wMUMWKUjv70Ver1vg@mail.gmail.com1 parent6bcda4a commit8b26769
File tree
18 files changed
+277
-284
lines changed- contrib
- hstore
- sepgsql
- src
- backend
- access
- brin
- rmgrdesc
- jit/llvm
- libpq
- postmaster
- replication/logical
- utils/adt
- bin
- pg_amcheck
- pg_dump
- pgbench
- psql
18 files changed
+277
-284
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1325 | 1325 |
| |
1326 | 1326 |
| |
1327 | 1327 |
| |
1328 |
| - | |
| 1328 | + | |
1329 | 1329 |
| |
1330 | 1330 |
| |
1331 | 1331 |
| |
| |||
1370 | 1370 |
| |
1371 | 1371 |
| |
1372 | 1372 |
| |
1373 |
| - | |
| 1373 | + | |
1374 | 1374 |
| |
1375 | 1375 |
| |
1376 | 1376 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
84 | 84 |
| |
85 | 85 |
| |
86 | 86 |
| |
87 |
| - | |
| 87 | + | |
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
|
Lines changed: 2 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3063 | 3063 |
| |
3064 | 3064 |
| |
3065 | 3065 |
| |
3066 |
| - | |
| 3066 | + | |
3067 | 3067 |
| |
3068 | 3068 |
| |
3069 | 3069 |
| |
| |||
3095 | 3095 |
| |
3096 | 3096 |
| |
3097 | 3097 |
| |
3098 |
| - | |
3099 |
| - | |
3100 |
| - | |
3101 | 3098 |
| |
3102 | 3099 |
| |
3103 |
| - | |
3104 |
| - | |
3105 |
| - | |
3106 |
| - | |
| 3100 | + | |
3107 | 3101 |
| |
3108 | 3102 |
| |
3109 | 3103 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
319 | 319 |
| |
320 | 320 |
| |
321 | 321 |
| |
322 |
| - | |
| 322 | + | |
323 | 323 |
| |
324 |
| - | |
| 324 | + | |
325 | 325 |
| |
326 | 326 |
| |
327 | 327 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
514 | 514 |
| |
515 | 515 |
| |
516 | 516 |
| |
517 |
| - | |
| 517 | + | |
518 | 518 |
| |
519 | 519 |
| |
520 | 520 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
899 | 899 |
| |
900 | 900 |
| |
901 | 901 |
| |
902 |
| - | |
| 902 | + | |
903 | 903 |
| |
904 | 904 |
| |
905 | 905 |
| |
| |||
912 | 912 |
| |
913 | 913 |
| |
914 | 914 |
| |
915 |
| - | |
| 915 | + | |
916 | 916 |
| |
917 | 917 |
| |
918 | 918 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4457 | 4457 |
| |
4458 | 4458 |
| |
4459 | 4459 |
| |
4460 |
| - | |
| 4460 | + | |
4461 | 4461 |
| |
4462 | 4462 |
| |
4463 | 4463 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
769 | 769 |
| |
770 | 770 |
| |
771 | 771 |
| |
772 |
| - | |
| 772 | + | |
773 | 773 |
| |
774 | 774 |
| |
775 | 775 |
| |
| |||
1062 | 1062 |
| |
1063 | 1063 |
| |
1064 | 1064 |
| |
1065 |
| - | |
| 1065 | + | |
1066 | 1066 |
| |
1067 | 1067 |
| |
1068 | 1068 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
99 |
| - | |
| 99 | + | |
100 | 100 |
| |
101 | 101 |
| |
102 | 102 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
219 | 219 |
| |
220 | 220 |
| |
221 | 221 |
| |
222 |
| - | |
| 222 | + | |
223 | 223 |
| |
224 | 224 |
| |
225 | 225 |
| |
|
Lines changed: 5 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1453 | 1453 |
| |
1454 | 1454 |
| |
1455 | 1455 |
| |
1456 |
| - | |
| 1456 | + | |
1457 | 1457 |
| |
1458 | 1458 |
| |
1459 | 1459 |
| |
| |||
2332 | 2332 |
| |
2333 | 2333 |
| |
2334 | 2334 |
| |
2335 |
| - | |
| 2335 | + | |
2336 | 2336 |
| |
2337 |
| - | |
| 2337 | + | |
2338 | 2338 |
| |
2339 | 2339 |
| |
2340 | 2340 |
| |
| |||
2363 | 2363 |
| |
2364 | 2364 |
| |
2365 | 2365 |
| |
2366 |
| - | |
| 2366 | + | |
2367 | 2367 |
| |
2368 | 2368 |
| |
2369 | 2369 |
| |
| |||
3583 | 3583 |
| |
3584 | 3584 |
| |
3585 | 3585 |
| |
3586 |
| - | |
| 3586 | + | |
3587 | 3587 |
| |
3588 | 3588 |
| |
3589 | 3589 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
131 | 131 |
| |
132 | 132 |
| |
133 | 133 |
| |
134 |
| - | |
| 134 | + | |
135 | 135 |
| |
136 | 136 |
| |
137 | 137 |
| |
|
Lines changed: 23 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1509 | 1509 |
| |
1510 | 1510 |
| |
1511 | 1511 |
| |
1512 |
| - | |
| 1512 | + | |
1513 | 1513 |
| |
1514 | 1514 |
| |
1515 | 1515 |
| |
| |||
1765 | 1765 |
| |
1766 | 1766 |
| |
1767 | 1767 |
| |
1768 |
| - | |
| 1768 | + | |
1769 | 1769 |
| |
1770 | 1770 |
| |
1771 | 1771 |
| |
| |||
1972 | 1972 |
| |
1973 | 1973 |
| |
1974 | 1974 |
| |
1975 |
| - | |
1976 |
| - | |
1977 |
| - | |
1978 |
| - | |
1979 |
| - | |
1980 |
| - | |
1981 |
| - | |
1982 |
| - | |
1983 |
| - | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
1984 | 1984 |
| |
1985 | 1985 |
| |
1986 | 1986 |
| |
| |||
2011 | 2011 |
| |
2012 | 2012 |
| |
2013 | 2013 |
| |
2014 |
| - | |
2015 |
| - | |
2016 |
| - | |
2017 |
| - | |
2018 |
| - | |
2019 |
| - | |
2020 |
| - | |
2021 |
| - | |
2022 |
| - | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
2023 | 2023 |
| |
2024 | 2024 |
| |
2025 | 2025 |
| |
| |||
2044 | 2044 |
| |
2045 | 2045 |
| |
2046 | 2046 |
| |
2047 |
| - | |
2048 |
| - | |
2049 |
| - | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
2050 | 2050 |
| |
2051 | 2051 |
| |
2052 | 2052 |
| |
|
0 commit comments
Comments
(0)