- Notifications
You must be signed in to change notification settings - Fork5
Commit3147acd
committed
Use improved vsnprintf calling logic in more places.
When we are using a C99-compliant vsnprintf implementation (which should bemost places, these days) it is worth the trouble to make use of its reportof how large the buffer needs to be to succeed. This patch adjustsstringinfo.c and some miscellaneous usages in pg_dump to do that, relyingon the logic recently added in libpgcommon's psprintf.c. Since theseplaces want to know the number of bytes written once we succeed, modify theAPI of pvsnprintf() to report that.There remains near-duplicate logic in pqexpbuffer.c, but since that codeis in libpq, psprintf.c's approach of exit()-on-error isn't appropriatefor use there. Also note that I didn't bother touching the multitudeof places that call (v)snprintf without any attempt to provide a resizablebuffer.Release-note-worthy incompatibility: the API of appendStringInfoVA()changed. If there's any third-party code that's calling that directly,it will need tweaking along the same lines as in this patch.David Rowley and Tom Lane1 parent98c5065 commit3147acd
File tree
8 files changed
+153
-137
lines changed- src
- backend
- lib
- utils/error
- bin/pg_dump
- common
- include
- lib
- utils
- pl/plpython
8 files changed
+153
-137
lines changedLines changed: 28 additions & 36 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
83 |
| - | |
| 83 | + | |
84 | 84 |
| |
85 | 85 |
| |
86 | 86 |
| |
87 |
| - | |
| 87 | + | |
88 | 88 |
| |
89 | 89 |
| |
90 |
| - | |
91 |
| - | |
| 90 | + | |
| 91 | + | |
92 | 92 |
| |
93 |
| - | |
94 |
| - | |
| 93 | + | |
| 94 | + | |
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
| |||
100 | 100 |
| |
101 | 101 |
| |
102 | 102 |
| |
103 |
| - | |
104 |
| - | |
105 |
| - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
106 | 107 |
| |
107 | 108 |
| |
108 | 109 |
| |
109 | 110 |
| |
110 | 111 |
| |
111 | 112 |
| |
112 |
| - | |
| 113 | + | |
113 | 114 |
| |
114 | 115 |
| |
115 |
| - | |
116 |
| - | |
| 116 | + | |
| 117 | + | |
117 | 118 |
| |
118 | 119 |
| |
119 | 120 |
| |
120 | 121 |
| |
121 | 122 |
| |
122 |
| - | |
| 123 | + | |
| 124 | + | |
123 | 125 |
| |
124 |
| - | |
| 126 | + | |
125 | 127 |
| |
126 |
| - | |
| 128 | + | |
127 | 129 |
| |
128 |
| - | |
129 |
| - | |
130 |
| - | |
131 |
| - | |
132 |
| - | |
133 |
| - | |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
| 130 | + | |
138 | 131 |
| |
139 |
| - | |
140 |
| - | |
141 |
| - | |
142 |
| - | |
143 |
| - | |
144 |
| - | |
145 |
| - | |
146 |
| - | |
| 132 | + | |
147 | 133 |
| |
148 | 134 |
| |
149 |
| - | |
150 |
| - | |
| 135 | + | |
| 136 | + | |
151 | 137 |
| |
152 | 138 |
| |
153 | 139 |
| |
154 | 140 |
| |
155 |
| - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
156 | 148 |
| |
157 | 149 |
| |
158 | 150 |
| |
|
Lines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
715 | 715 |
| |
716 | 716 |
| |
717 | 717 |
| |
718 |
| - | |
| 718 | + | |
719 | 719 |
| |
720 |
| - | |
| 720 | + | |
721 | 721 |
| |
722 |
| - | |
| 722 | + | |
723 | 723 |
| |
724 |
| - | |
| 724 | + | |
725 | 725 |
| |
726 | 726 |
| |
727 | 727 |
| |
| |||
758 | 758 |
| |
759 | 759 |
| |
760 | 760 |
| |
761 |
| - | |
| 761 | + | |
762 | 762 |
| |
763 |
| - | |
| 763 | + | |
764 | 764 |
| |
765 |
| - | |
| 765 | + | |
766 | 766 |
| |
767 |
| - | |
| 767 | + | |
768 | 768 |
| |
769 | 769 |
| |
770 | 770 |
| |
|
Lines changed: 44 additions & 36 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1183 | 1183 |
| |
1184 | 1184 |
| |
1185 | 1185 |
| |
1186 |
| - | |
1187 |
| - | |
1188 |
| - | |
1189 |
| - | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
1190 | 1189 |
| |
1191 |
| - | |
1192 |
| - | |
1193 |
| - | |
1194 |
| - | |
1195 |
| - | |
1196 |
| - | |
| 1190 | + | |
1197 | 1191 |
| |
1198 |
| - | |
1199 |
| - | |
1200 |
| - | |
1201 |
| - | |
1202 |
| - | |
1203 |
| - | |
1204 |
| - | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
1205 | 1208 |
| |
| 1209 | + | |
1206 | 1210 |
| |
1207 | 1211 |
| |
1208 |
| - | |
| 1212 | + | |
1209 | 1213 |
| |
1210 | 1214 |
| |
1211 | 1215 |
| |
| |||
1312 | 1316 |
| |
1313 | 1317 |
| |
1314 | 1318 |
| |
1315 |
| - | |
1316 |
| - | |
1317 |
| - | |
1318 |
| - | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
1319 | 1322 |
| |
1320 |
| - | |
1321 |
| - | |
1322 |
| - | |
1323 |
| - | |
1324 |
| - | |
1325 |
| - | |
| 1323 | + | |
1326 | 1324 |
| |
1327 |
| - | |
1328 |
| - | |
1329 |
| - | |
1330 |
| - | |
1331 |
| - | |
1332 |
| - | |
1333 |
| - | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
1334 | 1341 |
| |
| 1342 | + | |
1335 | 1343 |
| |
1336 | 1344 |
| |
1337 |
| - | |
| 1345 | + | |
1338 | 1346 |
| |
1339 | 1347 |
| |
1340 | 1348 |
| |
|
Lines changed: 22 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
996 | 996 |
| |
997 | 997 |
| |
998 | 998 |
| |
999 |
| - | |
1000 |
| - | |
1001 |
| - | |
1002 |
| - | |
1003 |
| - | |
1004 |
| - | |
1005 |
| - | |
1006 |
| - | |
1007 |
| - | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
1008 | 1002 |
| |
1009 |
| - | |
1010 |
| - | |
1011 |
| - | |
1012 |
| - | |
1013 |
| - | |
| 1003 | + | |
1014 | 1004 |
| |
1015 |
| - | |
1016 |
| - | |
1017 |
| - | |
1018 |
| - | |
1019 |
| - | |
1020 |
| - | |
1021 |
| - | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
1022 | 1021 |
| |
| 1022 | + | |
1023 | 1023 |
| |
1024 | 1024 |
| |
1025 |
| - | |
| 1025 | + | |
1026 | 1026 |
| |
1027 | 1027 |
| |
1028 | 1028 |
| |
|
0 commit comments
Comments
(0)