diff options
| author | bors <bors@rust-lang.org> | 2013-08-09 21:56:17 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-09 21:56:17 -0700 |
| commit | 60f5011005eda4f08f0c36fe56e4df07ae9a903f (patch) | |
| tree | 4f3636735525b80b6aa3c6fc37b88a5f9057548c /src/rt/rust_builtin.cpp | |
| parent | e81e81f234731a31fad9afdc2045bef3fbdf1109 (diff) | |
| parent | ee59aacac490edd619db1c4e2fcd848f793bc3b9 (diff) | |
| download | rust-60f5011005eda4f08f0c36fe56e4df07ae9a903f.tar.gz rust-60f5011005eda4f08f0c36fe56e4df07ae9a903f.zip | |
auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=erickt
This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects: * No interior nulls * Ends with a trailing null
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 0729cc1958b..ddd452deef2 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -292,10 +292,9 @@ void tm_to_rust_tm(tm* in_tm, rust_tm* out_tm, int32_t gmtoff, if (zone != NULL) { size_t size = strlen(zone); - reserve_vec_exact(&out_tm->tm_zone, size + 1); + reserve_vec_exact(&out_tm->tm_zone, size); memcpy(out_tm->tm_zone->data, zone, size); - out_tm->tm_zone->fill = size + 1; - out_tm->tm_zone->data[size] = '\0'; + out_tm->tm_zone->fill = size; } } |
