Skip to content

Commit 26c95b7

Browse files
committed
---
yaml --- r: 153105 b: refs/heads/try2 c: 67c8a8d h: refs/heads/master i: 153103: 950580c v: v3
1 parent 224f99e commit 26c95b7

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 717de500eefc2f501f12587fc9626944ab593ff8
8+
refs/heads/try2: 67c8a8d5dd90e476d0579df3738fe1e744ef68f1
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libserialize/json.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,20 @@ fn escape_char(writer: &mut io::Writer, v: char) -> Result<(), io::IoError> {
299299
escape_bytes(writer, buf)
300300
}
301301

302-
fn spaces(writer: &mut io::Writer, n: uint) -> Result<(), io::IoError> {
303-
for _ in range(0, n) {
304-
try!(writer.write_str(" "));
302+
fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> {
303+
static len: uint = 16;
304+
static buf: [u8, ..len] = [b' ', ..len];
305+
306+
while n >= len {
307+
try!(wr.write(buf));
308+
n -= len;
309+
}
310+
311+
if n > 0 {
312+
wr.write(buf.slice_to(n))
313+
} else {
314+
Ok(())
305315
}
306-
Ok(())
307316
}
308317

309318
fn fmt_number_or_null(v: f64) -> String {

0 commit comments

Comments
 (0)