Commit 6aa3570
committed
windows: Make readLinkW APIs output WTF-16, reduce stack usage of callers
- Affects the following functions:
+ `std.fs.Dir.readLinkW`
+ `std.os.windows.ReadLink`
+ `std.os.windows.ntToWin32Namespace`
+ `std.posix.readlinkW`
+ `std.posix.readlinkatW`
Each of these functions (except `ntToWin32Namespace`) took WTF-16 as input and would output WTF-8, which makes optimal buffer re-use difficult at callsites and could force unnecessary WTF-16 <-> WTF-8 conversion during an intermediate step.
The functions have been updated to output WTF-16, and also allow for the path and the output to re-use the same buffer (i.e. in-place modification), which can reduce the stack usage at callsites. For example, all of `std.fs.Dir.readLink`/`readLinkZ`/`std.posix.readlink`/`readlinkZ`/`readlinkat`/`readlinkatZ` have had their stack usage reduced by one PathSpace struct (64 KiB) when targeting Windows.
The new `ntToWin32Namespace` takes an output buffer and returns a slice from that instead of returning a PathSpace, which is necessary to make the above possible.1 parent 06a7597 commit 6aa3570
4 files changed
+119
-65
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1354 | 1354 | | |
1355 | 1355 | | |
1356 | 1356 | | |
1357 | | - | |
1358 | | - | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
1359 | 1365 | | |
1360 | 1366 | | |
1361 | 1367 | | |
| |||
1369 | 1375 | | |
1370 | 1376 | | |
1371 | 1377 | | |
1372 | | - | |
1373 | | - | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
1374 | 1386 | | |
1375 | 1387 | | |
1376 | 1388 | | |
1377 | 1389 | | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
1381 | 1396 | | |
1382 | 1397 | | |
1383 | 1398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
196 | 199 | | |
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
| |||
205 | 211 | | |
206 | 212 | | |
207 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
208 | 217 | | |
209 | 218 | | |
210 | 219 | | |
| |||
215 | 224 | | |
216 | 225 | | |
217 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
218 | 238 | | |
219 | 239 | | |
220 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
894 | 894 | | |
895 | 895 | | |
896 | 896 | | |
897 | | - | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
898 | 900 | | |
899 | 901 | | |
900 | 902 | | |
| |||
926 | 928 | | |
927 | 929 | | |
928 | 930 | | |
929 | | - | |
| 931 | + | |
930 | 932 | | |
931 | 933 | | |
932 | 934 | | |
933 | 935 | | |
934 | 936 | | |
935 | 937 | | |
936 | | - | |
| 938 | + | |
937 | 939 | | |
938 | 940 | | |
939 | 941 | | |
940 | 942 | | |
941 | 943 | | |
942 | 944 | | |
943 | 945 | | |
944 | | - | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
952 | 952 | | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
957 | 958 | | |
958 | 959 | | |
959 | 960 | | |
| |||
2584 | 2585 | | |
2585 | 2586 | | |
2586 | 2587 | | |
2587 | | - | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
2588 | 2591 | | |
2589 | 2592 | | |
2590 | | - | |
2591 | 2593 | | |
2592 | 2594 | | |
2593 | 2595 | | |
2594 | 2596 | | |
2595 | 2597 | | |
2596 | 2598 | | |
2597 | 2599 | | |
2598 | | - | |
2599 | | - | |
2600 | | - | |
2601 | | - | |
2602 | 2600 | | |
2603 | | - | |
| 2601 | + | |
2604 | 2602 | | |
| 2603 | + | |
| 2604 | + | |
2605 | 2605 | | |
2606 | | - | |
| 2606 | + | |
2607 | 2607 | | |
2608 | 2608 | | |
2609 | 2609 | | |
2610 | 2610 | | |
2611 | | - | |
2612 | | - | |
2613 | | - | |
2614 | | - | |
| 2611 | + | |
| 2612 | + | |
2615 | 2613 | | |
2616 | 2614 | | |
2617 | 2615 | | |
| |||
2620 | 2618 | | |
2621 | 2619 | | |
2622 | 2620 | | |
2623 | | - | |
2624 | | - | |
2625 | | - | |
2626 | | - | |
| 2621 | + | |
| 2622 | + | |
2627 | 2623 | | |
2628 | | - | |
2629 | | - | |
2630 | | - | |
2631 | | - | |
2632 | | - | |
2633 | | - | |
2634 | | - | |
2635 | | - | |
2636 | | - | |
2637 | | - | |
| 2624 | + | |
| 2625 | + | |
2638 | 2626 | | |
2639 | | - | |
2640 | | - | |
2641 | | - | |
| 2627 | + | |
| 2628 | + | |
2642 | 2629 | | |
2643 | 2630 | | |
2644 | 2631 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3021 | 3021 | | |
3022 | 3022 | | |
3023 | 3023 | | |
3024 | | - | |
3025 | | - | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
3026 | 3032 | | |
3027 | 3033 | | |
3028 | 3034 | | |
3029 | 3035 | | |
3030 | 3036 | | |
3031 | 3037 | | |
3032 | | - | |
3033 | | - | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
3034 | 3044 | | |
3035 | | - | |
| 3045 | + | |
3036 | 3046 | | |
3037 | 3047 | | |
3038 | 3048 | | |
3039 | 3049 | | |
3040 | 3050 | | |
3041 | 3051 | | |
3042 | | - | |
3043 | | - | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
3044 | 3060 | | |
3045 | 3061 | | |
3046 | 3062 | | |
| |||
3075 | 3091 | | |
3076 | 3092 | | |
3077 | 3093 | | |
3078 | | - | |
3079 | | - | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
3080 | 3102 | | |
3081 | 3103 | | |
3082 | 3104 | | |
| |||
3103 | 3125 | | |
3104 | 3126 | | |
3105 | 3127 | | |
3106 | | - | |
3107 | | - | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
3108 | 3134 | | |
3109 | | - | |
| 3135 | + | |
3110 | 3136 | | |
3111 | 3137 | | |
3112 | 3138 | | |
3113 | 3139 | | |
3114 | 3140 | | |
3115 | 3141 | | |
3116 | 3142 | | |
3117 | | - | |
3118 | | - | |
| 3143 | + | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
3119 | 3151 | | |
3120 | 3152 | | |
3121 | 3153 | | |
| |||
0 commit comments