@@ -10,7 +10,6 @@ const windows = os.windows;
10
10
const mem = std .mem ;
11
11
const debug = std .debug ;
12
12
const BufMap = std .BufMap ;
13
- const Buffer = std .Buffer ;
14
13
const builtin = @import ("builtin" );
15
14
const Os = builtin .Os ;
16
15
const TailQueue = std .TailQueue ;
@@ -777,36 +776,36 @@ fn windowsCreateProcess(app_name: [*:0]u16, cmd_line: [*:0]u16, envp_ptr: ?[*]u1
777
776
/// Caller must dealloc.
778
777
/// Guarantees a null byte at result[result.len].
779
778
fn windowsCreateCommandLine (allocator : * mem.Allocator , argv : []const []const u8 ) ! []u8 {
780
- var buf = try Buffer . initSize ( allocator , 0 );
779
+ var buf = std . ArrayList ( u8 ). init ( allocator );
781
780
defer buf .deinit ();
782
781
783
782
var 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 .append (' ' );
787
786
if (mem .indexOfAny (u8 , arg , " \t \n \" " ) == null ) {
788
- try buf .append (arg );
787
+ try buf .appendSlice (arg );
789
788
continue ;
790
789
}
791
- try buf .appendByte ('"' );
790
+ try buf .append ('"' );
792
791
var backslash_count : usize = 0 ;
793
792
for (arg ) | byte | {
794
793
switch (byte ) {
795
794
'\\ ' = > backslash_count += 1 ,
796
795
'"' = > {
797
- try buf_stream . writeByteNTimes ('\\ ' , backslash_count * 2 + 1 );
798
- try buf .appendByte ('"' );
796
+ try buf . appendNTimes ('\\ ' , backslash_count * 2 + 1 );
797
+ try buf .append ('"' );
799
798
backslash_count = 0 ;
800
799
},
801
800
else = > {
802
- try buf_stream . writeByteNTimes ('\\ ' , backslash_count );
803
- try buf .appendByte (byte );
801
+ try buf . appendNTimes ('\\ ' , backslash_count );
802
+ try buf .append (byte );
804
803
backslash_count = 0 ;
805
804
},
806
805
}
807
806
}
808
- try buf_stream . writeByteNTimes ('\\ ' , backslash_count * 2 );
809
- try buf .appendByte ('"' );
807
+ try buf . appendNTimes ('\\ ' , backslash_count * 2 );
808
+ try buf .append ('"' );
810
809
}
811
810
812
811
return buf .toOwnedSlice ();
0 commit comments