diff options
Diffstat (limited to 'src/badlib.h')
-rw-r--r-- | src/badlib.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/badlib.h b/src/badlib.h index 73e03db..c73b57f 100644 --- a/src/badlib.h +++ b/src/badlib.h | |||
@@ -347,7 +347,9 @@ str_split_fn(Str *a, StrSplitFn split_fn) { | |||
347 | void | 347 | void |
348 | str_replace(Str *a, Str from, Str to) { | 348 | str_replace(Str *a, Str from, Str to) { |
349 | assert(a != NULL); | 349 | assert(a != NULL); |
350 | assert(from.size == to.size); | 350 | if (from.size != to.size) { |
351 | return; | ||
352 | } | ||
351 | SearchResult res = array_find_next(*a, from); | 353 | SearchResult res = array_find_next(*a, from); |
352 | if (res.found) { | 354 | if (res.found) { |
353 | memcpy(a->mem + res.pos, to.mem, res.matched); | 355 | memcpy(a->mem + res.pos, to.mem, res.matched); |
@@ -1498,7 +1500,7 @@ void | |||
1498 | log_func_memory(Logger *l, void *in) { | 1500 | log_func_memory(Logger *l, void *in) { |
1499 | assert(l); | 1501 | assert(l); |
1500 | Array *val = in; | 1502 | Array *val = in; |
1501 | for (sz i = 0; i < MIN(64, val->size); i++) { | 1503 | for (sz i = 0; i < MIN(256, val->size); i++) { |
1502 | Arena scratch = l->storage; | 1504 | Arena scratch = l->storage; |
1503 | log_str(l, str_from_hex(val->mem[i], 2, &scratch)); | 1505 | log_str(l, str_from_hex(val->mem[i], 2, &scratch)); |
1504 | if ((i + 1) % 16 == 0) { | 1506 | if ((i + 1) % 16 == 0) { |