|
|
@@ -176,11 +176,9 @@ AlgoChooserProfileCache::get(const Key &key) { |
|
|
|
|
|
|
|
auto entry_len = read_uint32(); |
|
|
|
mgb_assert(buf + entry_len <= buf_end); |
|
|
|
int rep; |
|
|
|
auto nr = sscanf(reinterpret_cast<const char*>(buf), ENTRY_FMT, |
|
|
|
&rep, &i.time, &i.workspace); |
|
|
|
&i.reproducible, &i.time, &i.workspace); |
|
|
|
mgb_assert(nr == 3); |
|
|
|
i.reproducible = rep; |
|
|
|
buf += entry_len; |
|
|
|
} |
|
|
|
mgb_assert(buf == buf_end); |
|
|
@@ -228,6 +226,8 @@ void AlgoChooserProfileCache::put(const Key &key, Result &result) { |
|
|
|
val.resize(pos + SPR_SIZE); |
|
|
|
uint32_t nr = snprintf(&val[pos], SPR_SIZE, |
|
|
|
ENTRY_FMT, i.reproducible, i.time, i.workspace); |
|
|
|
//! for memory boundary failed, snprintf ret do not contain \0 |
|
|
|
nr += 1; |
|
|
|
mgb_assert(nr < SPR_SIZE); |
|
|
|
memcpy(&val[pos - sizeof(uint32_t)], &nr, sizeof(nr)); |
|
|
|
val.resize(pos + nr); |
|
|
|