Commit 110656b
patch 9.1.1887: string handling in strings.c can be improved
Problem: string handling in strings.c can be improved
Solution: Refactor strings.c and remove calls to STRLEN()
(John Marriott)
This change does:
- In vim_strsave_shellescape() a small cosmetic change.
- In string_count() move the call to STRLEN() outside the while loop.
- In blob_from_string() refactor to remove call to STRLEN().
- In string_from_blob() call vim_strnsave() instead of vim_strsave().
- In vim_snprintf_safelen() call vim_vsnprintf_typval() directly instead
of vim_vsnprintf() which then calls vim_vsnprintf_typval().
- In copy_first_char_to_tv() change to return -1 on failure or the length
of resulting v_string. Change string_filter_map() and string_reduce() to
use the return value of copy_first_char_to_tv().
closes: #18617
Signed-off-by: John Marriott <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>1 parent 469f870 commit 110656b
2 files changed
+24
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
884 | 884 | | |
885 | 885 | | |
886 | 886 | | |
| 887 | + | |
887 | 888 | | |
888 | 889 | | |
889 | | - | |
890 | | - | |
891 | 890 | | |
892 | 891 | | |
893 | | - | |
| 892 | + | |
894 | 893 | | |
895 | 894 | | |
896 | | - | |
| 895 | + | |
897 | 896 | | |
898 | 897 | | |
899 | 898 | | |
| |||
903 | 902 | | |
904 | 903 | | |
905 | 904 | | |
906 | | - | |
| 905 | + | |
907 | 906 | | |
908 | 907 | | |
909 | 908 | | |
910 | 909 | | |
911 | 910 | | |
912 | 911 | | |
913 | 912 | | |
914 | | - | |
| 913 | + | |
915 | 914 | | |
916 | 915 | | |
917 | 916 | | |
| |||
920 | 919 | | |
921 | 920 | | |
922 | 921 | | |
923 | | - | |
| 922 | + | |
924 | 923 | | |
925 | 924 | | |
926 | 925 | | |
927 | 926 | | |
928 | 927 | | |
929 | | - | |
| 928 | + | |
930 | 929 | | |
931 | | - | |
| 930 | + | |
932 | 931 | | |
933 | 932 | | |
934 | 933 | | |
| |||
963 | 962 | | |
964 | 963 | | |
965 | 964 | | |
966 | | - | |
| 965 | + | |
| 966 | + | |
967 | 967 | | |
968 | | - | |
969 | 968 | | |
970 | 969 | | |
971 | 970 | | |
| |||
1026 | 1025 | | |
1027 | 1026 | | |
1028 | 1027 | | |
1029 | | - | |
| 1028 | + | |
| 1029 | + | |
1030 | 1030 | | |
1031 | | - | |
| 1031 | + | |
1032 | 1032 | | |
1033 | 1033 | | |
1034 | 1034 | | |
| |||
1041 | 1041 | | |
1042 | 1042 | | |
1043 | 1043 | | |
1044 | | - | |
| 1044 | + | |
| 1045 | + | |
1045 | 1046 | | |
1046 | | - | |
1047 | 1047 | | |
1048 | 1048 | | |
1049 | 1049 | | |
| |||
1221 | 1221 | | |
1222 | 1222 | | |
1223 | 1223 | | |
1224 | | - | |
| 1224 | + | |
1225 | 1225 | | |
1226 | | - | |
| 1226 | + | |
1227 | 1227 | | |
1228 | | - | |
1229 | | - | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
| 1228 | + | |
| 1229 | + | |
1235 | 1230 | | |
1236 | 1231 | | |
1237 | 1232 | | |
| |||
1267 | 1262 | | |
1268 | 1263 | | |
1269 | 1264 | | |
1270 | | - | |
1271 | | - | |
1272 | | - | |
| 1265 | + | |
1273 | 1266 | | |
1274 | 1267 | | |
1275 | 1268 | | |
| |||
2648 | 2641 | | |
2649 | 2642 | | |
2650 | 2643 | | |
2651 | | - | |
| 2644 | + | |
2652 | 2645 | | |
2653 | 2646 | | |
2654 | 2647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
| 732 | + | |
| 733 | + | |
732 | 734 | | |
733 | 735 | | |
734 | 736 | | |
| |||
0 commit comments