rt: Remove last use of C++ exchange alloc
This commit is contained in:
parent
2c0f9bd354
commit
74b2d9e19b
@ -121,6 +121,9 @@ pub struct Tm {
|
||||
}
|
||||
|
||||
pub fn empty_tm() -> Tm {
|
||||
// 64 is the max size of the timezone buffer allocated on windows
|
||||
// in rust_localtime. In glibc the max timezone size is supposedly 3.
|
||||
let zone = str::with_capacity(64);
|
||||
Tm {
|
||||
tm_sec: 0_i32,
|
||||
tm_min: 0_i32,
|
||||
@ -132,7 +135,7 @@ pub fn empty_tm() -> Tm {
|
||||
tm_yday: 0_i32,
|
||||
tm_isdst: 0_i32,
|
||||
tm_gmtoff: 0_i32,
|
||||
tm_zone: ~"",
|
||||
tm_zone: zone,
|
||||
tm_nsec: 0_i32,
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ 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);
|
||||
assert(out_tm->tm_zone->alloc >= size);
|
||||
memcpy(out_tm->tm_zone->data, zone, size);
|
||||
out_tm->tm_zone->fill = size;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user