Project

General

Profile

Bug #13853 ยป json-ruby23.patch

hsbt (Hiroshi SHIBATA), 09/07/2017 01:10 AM

View differences:

ext/json/generator/generator.c
301 301
  char *result;
302 302
  if (len <= 0) return NULL;
303 303
  result = ALLOC_N(char, len);
304
  memccpy(result, ptr, 0, len);
304
  memcpy(result, ptr, len);
305 305
  return result;
306 306
}
307 307

  
......
1055 1055
        }
1056 1056
    } else {
1057 1057
        if (state->indent) ruby_xfree(state->indent);
1058
        state->indent = strdup(RSTRING_PTR(indent));
1058
        state->indent = fstrndup(RSTRING_PTR(indent), len);
1059 1059
        state->indent_len = len;
1060 1060
    }
1061 1061
    return Qnil;
......
1093 1093
        }
1094 1094
    } else {
1095 1095
        if (state->space) ruby_xfree(state->space);
1096
        state->space = strdup(RSTRING_PTR(space));
1096
        state->space = fstrndup(RSTRING_PTR(space), len);
1097 1097
        state->space_len = len;
1098 1098
    }
1099 1099
    return Qnil;
......
1129 1129
        }
1130 1130
    } else {
1131 1131
        if (state->space_before) ruby_xfree(state->space_before);
1132
        state->space_before = strdup(RSTRING_PTR(space_before));
1132
        state->space_before = fstrndup(RSTRING_PTR(space_before), len);
1133 1133
        state->space_before_len = len;
1134 1134
    }
1135 1135
    return Qnil;
......
1166 1166
        }
1167 1167
    } else {
1168 1168
        if (state->object_nl) ruby_xfree(state->object_nl);
1169
        state->object_nl = strdup(RSTRING_PTR(object_nl));
1169
        state->object_nl = fstrndup(RSTRING_PTR(object_nl), len);
1170 1170
        state->object_nl_len = len;
1171 1171
    }
1172 1172
    return Qnil;
......
1201 1201
        }
1202 1202
    } else {
1203 1203
        if (state->array_nl) ruby_xfree(state->array_nl);
1204
        state->array_nl = strdup(RSTRING_PTR(array_nl));
1204
        state->array_nl = fstrndup(RSTRING_PTR(array_nl), len);
1205 1205
        state->array_nl_len = len;
1206 1206
    }
1207 1207
    return Qnil;
ext/json/generator/generator.h
1 1
#ifndef _GENERATOR_H_
2 2
#define _GENERATOR_H_
3 3

  
4
#include <string.h>
5 4
#include <math.h>
6 5
#include <ctype.h>
7 6

  
ext/json/json.gemspec
1 1
Gem::Specification.new do |s|
2 2
  s.name = "json"
3
  s.version = "1.8.3"
3
  s.version = "1.8.3.1"
4 4
  s.summary = "This json is bundled with Ruby"
5 5
  s.executables = []
6 6
  s.files = ["json.rb", "json/add/bigdecimal.rb", "json/add/complex.rb", "json/add/core.rb", "json/add/date.rb", "json/add/date_time.rb", "json/add/exception.rb", "json/add/ostruct.rb", "json/add/range.rb", "json/add/rational.rb", "json/add/regexp.rb", "json/add/struct.rb", "json/add/symbol.rb", "json/add/time.rb", "json/common.rb", "json/ext.rb", "json/ext/generator.bundle", "json/ext/parser.bundle", "json/generic_object.rb", "json/version.rb"]
ext/json/lib/json/version.rb
1 1
# frozen_string_literal: false
2 2
module JSON
3 3
  # JSON version
4
  VERSION         = '1.8.3'
4
  VERSION         = '1.8.3.1'
5 5
  VERSION_ARRAY   = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6 6
  VERSION_MAJOR   = VERSION_ARRAY[0] # :nodoc:
7 7
  VERSION_MINOR   = VERSION_ARRAY[1] # :nodoc: