@@ -776,37 +776,36 @@ fn windowsCreateProcess(app_name: [*:0]u16, cmd_line: [*:0]u16, envp_ptr: ?[*]u1
776
776
777
777
/// Caller must dealloc.
778
778
/// Guarantees a null byte at result[result.len].
779
- fn windowsCreateCommandLine (allocator : * mem.Allocator , argv : []const []const u8 ) ! []u8 {
779
+ fn windowsCreateCommandLine (allocator : * mem.Allocator , argv : []const []const u8 ) ! [: 0 ]u8 {
780
780
var buf = try Buffer .initSize (allocator , 0 );
781
781
defer buf .deinit ();
782
-
783
- var buf_stream = buf .outStream ();
782
+ const buf_stream = buf .outStream ();
784
783
785
784
for (argv ) | arg , arg_i | {
786
- if (arg_i != 0 ) try buf . appendByte (' ' );
785
+ if (arg_i != 0 ) try buf_stream . writeByte (' ' );
787
786
if (mem .indexOfAny (u8 , arg , " \t \n \" " ) == null ) {
788
- try buf . append (arg );
787
+ try buf_stream . writeAll (arg );
789
788
continue ;
790
789
}
791
- try buf . appendByte ('"' );
790
+ try buf_stream . writeByte ('"' );
792
791
var backslash_count : usize = 0 ;
793
792
for (arg ) | byte | {
794
793
switch (byte ) {
795
794
'\\ ' = > backslash_count += 1 ,
796
795
'"' = > {
797
796
try buf_stream .writeByteNTimes ('\\ ' , backslash_count * 2 + 1 );
798
- try buf . appendByte ('"' );
797
+ try buf_stream . writeByte ('"' );
799
798
backslash_count = 0 ;
800
799
},
801
800
else = > {
802
801
try buf_stream .writeByteNTimes ('\\ ' , backslash_count );
803
- try buf . appendByte (byte );
802
+ try buf_stream . writeByte (byte );
804
803
backslash_count = 0 ;
805
804
},
806
805
}
807
806
}
808
807
try buf_stream .writeByteNTimes ('\\ ' , backslash_count * 2 );
809
- try buf . appendByte ('"' );
808
+ try buf_stream . writeByte ('"' );
810
809
}
811
810
812
811
return buf .toOwnedSlice ();
0 commit comments