diff options
-rw-r--r-- | ext/json/generator/generator.c | 18 | ||||
-rw-r--r-- | ext/json/generator/generator.h | 1 |
2 files changed, 3 insertions, 16 deletions
@@ -421,7 +421,6 @@ static void State_free(void *ptr) if (state->space_before) ruby_xfree(state->space_before); if (state->object_nl) ruby_xfree(state->object_nl); if (state->array_nl) ruby_xfree(state->array_nl); - if (state->object_delim2) fbuffer_free(state->object_delim2); ruby_xfree(state); } @@ -434,7 +433,6 @@ static size_t State_memsize(const void *ptr) if (state->space_before) size += state->space_before_len + 1; if (state->object_nl) size += state->object_nl_len + 1; if (state->array_nl) size += state->array_nl_len + 1; - if (state->object_delim2) size += FBUFFER_CAPA(state->object_delim2); return size; } @@ -648,8 +646,6 @@ json_object_i(VALUE key, VALUE val, VALUE _arg) long object_nl_len = state->object_nl_len; char *indent = state->indent; long indent_len = state->indent_len; - char *delim2 = FBUFFER_PTR(state->object_delim2); - long delim2_len = FBUFFER_LEN(state->object_delim2); long depth = state->depth; int j; @@ -677,7 +673,9 @@ json_object_i(VALUE key, VALUE val, VALUE _arg) } generate_json_string(buffer, Vstate, state, key_to_s); - fbuffer_append(buffer, delim2, delim2_len); generate_json(buffer, Vstate, state, val); arg->iter++; @@ -885,15 +883,6 @@ static FBuffer *cState_prepare_buffer(VALUE self) GET_STATE(self); buffer = fbuffer_alloc(state->buffer_initial_length); - if (state->object_delim2) { - fbuffer_clear(state->object_delim2); - } else { - state->object_delim2 = fbuffer_alloc(16); - } - if (state->space_before) fbuffer_append(state->object_delim2, state->space_before, state->space_before_len); - fbuffer_append_char(state->object_delim2, ':'); - if (state->space) fbuffer_append(state->object_delim2, state->space, state->space_len); - return buffer; } @@ -1006,7 +995,6 @@ static VALUE cState_init_copy(VALUE obj, VALUE orig) objState->space_before = fstrndup(origState->space_before, origState->space_before_len); objState->object_nl = fstrndup(origState->object_nl, origState->object_nl_len); objState->array_nl = fstrndup(origState->array_nl, origState->array_nl_len); - if (origState->object_delim2) objState->object_delim2 = fbuffer_dup(origState->object_delim2); return obj; } @@ -55,7 +55,6 @@ typedef struct JSON_Generator_StateStruct { long object_nl_len; char *array_nl; long array_nl_len; - FBuffer *object_delim2; long max_nesting; char allow_nan; char ascii_only; |