Skip to content

Commit

Permalink
Move mrb_assert() position.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Jan 6, 2017
1 parent 5d0b945 commit 9a76a0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ mrb_str_buf_new(mrb_state *mrb, size_t capa)
static void
resize_capa(mrb_state *mrb, struct RString *s, size_t capacity)
{
#if SIZE_MAX > MRB_INT_MAX
mrb_assert(capacity < MRB_INT_MAX);
#endif
if (RSTR_EMBED_P(s)) {
if (RSTRING_EMBED_LEN_MAX < capacity) {
char *const tmp = (char *)mrb_malloc(mrb, capacity+1);
Expand All @@ -133,9 +136,6 @@ resize_capa(mrb_state *mrb, struct RString *s, size_t capacity)
}
}
else {
#if SIZE_MAX > MRB_INT_MAX
mrb_assert(capacity <= MRB_INT_MAX);
#endif
s->as.heap.ptr = (char *)mrb_realloc(mrb, RSTR_PTR(s), capacity+1);
s->as.heap.aux.capa = capacity;
}
Expand Down

0 comments on commit 9a76a0b

Please sign in to comment.