Skip to content

Merge upstream 2.1.1 #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 84 commits into from
Mar 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
a1d56b1
merge revision(s) 44488: [Backport #9341]
nurse Jan 8, 2014
f072232
merge revision(s) 44440,44444: [Backport #9306]
nurse Jan 9, 2014
0957229
merge revision(s) 44544:
nurse Jan 11, 2014
820b714
* 2014-01-11
matzbot Jan 11, 2014
b0d69f3
merge revision(s) 44598,44599,44600:
nurse Jan 15, 2014
111cbcb
merge revision(s) 44601:
nurse Jan 15, 2014
ba97a56
merge revision(s) 44358,44359,44360,44363: [Backport #9275]
nurse Jan 23, 2014
7d1ca1a
merge revision(s) 44402: [Backport #9301]
nurse Jan 27, 2014
3296771
merge revision(s) 44588: [Backport #9316]
nurse Jan 27, 2014
fec2e7e
merge revision(s) 44756:
nurse Jan 30, 2014
286933b
merge revision(s) 44406: [Backport #9324]
nurse Jan 31, 2014
528dfd0
merge revision(s) 44455,44458,44510: [Backport #9349]
nurse Jan 31, 2014
905fb0d
merge revision(s) 44515: [Backport #9375]
nurse Jan 31, 2014
ad5dc28
Revert r44778 #9375
nurse Feb 1, 2014
5d6066e
* 2014-02-01
matzbot Feb 1, 2014
21942cd
merge revision(s) 44373: [Backport #9417]
nurse Feb 1, 2014
7933cae
merge revision(s) 44630,44631: [Backport #9403]
nurse Feb 2, 2014
3e5f9b1
merge revision(s) 44803: [Backport #9478]
nurse Feb 5, 2014
9b614cb
merge revision(s) 44501: [Backport #9353]
nurse Feb 5, 2014
a933f15
merge revision(s) 44512: [Backport #9340]
nurse Feb 5, 2014
628e78d
merge revision(s) 44517,44518,44519,44523: [Backport #9354]
nurse Feb 5, 2014
61faac8
merge revision(s) 44490,44496: [Backport #9352]
nurse Feb 5, 2014
b208f1e
merge revision(s) 44527,44552,44553:
nurse Feb 5, 2014
7d53e2b
merge revision(s) 44525,44534,44537: [Backport #9381]
nurse Feb 5, 2014
9a372fa
merge revision(s) 44583: [Backport #9302]
nurse Feb 5, 2014
898c29a
merge revision(s) 44555:
nurse Feb 5, 2014
c464602
merge revision(s) 44853: [Backport #9490]
nurse Feb 6, 2014
7b38343
* lib/rubygems: RubyGems 2.2.2 which contains the following bug fixes:
nurse Feb 6, 2014
1ef33a5
merge revision(s) 44852: [Backport #9343]
nurse Feb 6, 2014
3557554
Add missing file of r44858
nurse Feb 6, 2014
7895c20
* 2014-02-07
matzbot Feb 6, 2014
783bcda
merge revision(s) 44861,44862: [Backport #9493]
nurse Feb 6, 2014
a21d16c
merge revision(s) 44572,44578,44591,44592: [Backport #9490]
nurse Feb 10, 2014
aeb412e
merge revision(s) 44579: [Backport #9500]
nurse Feb 10, 2014
84fe2b2
merge revision(s) 44474,44538,44539,44890,44896: [Backport #9495]
nurse Feb 16, 2014
b258a15
merge revision(s) 44476: [Backport #9317]
nurse Feb 16, 2014
7eaa356
merge revision(s) 44492: [Backport #9351]
nurse Feb 18, 2014
0af103b
merge revision(s) 45021,45022,45028: [Backport #9524]
nurse Feb 19, 2014
41950b1
merge revision(s) 44327: [Backport #9276]
nurse Feb 19, 2014
54c00c0
* 2014-02-20
matzbot Feb 19, 2014
2fe30c1
merge revision(s) 44638: [Backport #9350]
nurse Feb 20, 2014
5b05fa5
merge revision(s) 44494:
nurse Feb 20, 2014
05558c9
merge revision(s) 44687,44706,44727: [Backport #8770]
nurse Feb 20, 2014
b0578a2
merge revision(s) 44654: [Backport #9426]
nurse Feb 20, 2014
42f1c52
merge revision(s) 44720: [Backport #9455]
nurse Feb 21, 2014
d25384c
merge revision(s) 44604,44605,44606: [Backport #9415]
nurse Feb 21, 2014
210995b
merge revision(s) 44312,44318: [Backport #9273]
nurse Feb 21, 2014
21b0096
merge revision(s) 44790: [Backport #9472]
nurse Feb 21, 2014
43fde88
merge revision(s) 44531: [Backport #9300]
nurse Feb 21, 2014
41196a7
merge revision(s) 44472: [Backport #9333]
nurse Feb 21, 2014
2ae49e7
merge revision(s) 44469: [Backport #9329]
nurse Feb 21, 2014
37095c4
merge revision(s) 44462,44477: [Backport #9314]
nurse Feb 21, 2014
c22f44b
merge revision(s) 44616,44622,44623,44626,44632,44636:
nurse Feb 21, 2014
de3abc8
merge revision(s) 44449: [Backport #9416]
nurse Feb 21, 2014
17ad6f4
merge revision(s) 44925: [Backport #9492]
nurse Feb 21, 2014
df38246
merge revision(s) 44595: [Backport #9342]
nurse Feb 22, 2014
276b6b8
merge revision(s) 44568: [Backport #9399]
nurse Feb 22, 2014
cf3896b
merge revision(s) 44931: [Backport #9452]
nurse Feb 22, 2014
650f200
merge revision(s) 44884: [Backport #9498]
nurse Feb 22, 2014
e8c1c96
merge revision(s) 44880: [Backport #9477]
nurse Feb 22, 2014
10be2aa
merge revision(s) 44585: [Backport #9268]
nurse Feb 22, 2014
f9fb834
merge revision(s) 44586: [Backport #9152]
nurse Feb 22, 2014
cb38be4
merge revision(s) 44584,44587,44945: [Backport #9243]
nurse Feb 22, 2014
957bd76
merge revision(s) 44642: [Backport #9093]
nurse Feb 22, 2014
bda92e9
merge revision(s) 44463: [Backport #9210]
nurse Feb 22, 2014
8f7b410
merge revision(s) 44878,44879: [Backport #9483]
nurse Feb 22, 2014
52ed9b4
merge revision(s) 44696: [Backport #9429]
nurse Feb 22, 2014
b3445c0
merge revision(s) 44549: [Backport #9387]
nurse Feb 22, 2014
61d1261
merge revision(s) 44670,44671,44673,44675: [Backport #8783]
nurse Feb 22, 2014
dc8c558
merge revision(s) 45066: [Backport #9545] [Backport #9550]
nurse Feb 22, 2014
c3729ca
merge revision(s) 44772: [Backport #9430]
nurse Feb 22, 2014
bed9d6c
merge revision(s) 44731,44751: [Backport #8978]
nurse Feb 22, 2014
42ffa2e
merge revision(s) 44514: [Backport #9374]
nurse Feb 22, 2014
5d59efc
merge revision(s) 44628: [Backport #9413]
nurse Feb 22, 2014
e16f765
merge revision(s) 44637: [Backport #9385]
nurse Feb 22, 2014
ada0c63
merge revision(s) 45057,45059: [Backport #9533]
nurse Feb 22, 2014
8a059b4
merge revision(s) 45076: [Backport #9535]
nurse Feb 22, 2014
f577abf
merge revision(s) 45084: [Backport #9547]
nurse Feb 22, 2014
0025fef
merge revision(s) 44412,44413,44414,44420,44421: [Backport #9298]
nurse Feb 22, 2014
aac2d82
merge revision(s) 45130: [Backport #9554]
nurse Feb 22, 2014
67a696c
merge revision(s) 44809,44811,44813,44815,44816,44817,44818,44918,450…
nurse Feb 24, 2014
1980b4d
add tag v2_1_1
nurse Feb 24, 2014
492f7bd
Merge tag 'v2_1_1' into 2.1
dbussink Mar 10, 2014
5b54c3b
merge revision(s) 44370: [Backport #9576]
nurse Mar 1, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
572 changes: 571 additions & 1 deletion ChangeLog

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ with all sufficient information, see the ChangeLog file.
* Process.clock_getres

* String
* "literal".freeze is now optimized to return the same object
* New methods:
* String#scrub and String#scrub! verify and fix invalid byte sequence.
If you want to use this function with older Ruby,
Expand All @@ -133,6 +134,10 @@ with all sufficient information, see the ChangeLog file.

=== Core classes compatibility issues (excluding feature bug fixes)

* Dir
* incompatible changes:
* Dir#glob returns composed characters (previously Apple Modofied UTF-8).

* Hash
* incompatible changes:
* Hash#reject will return plain Hash object in the future versions, that
Expand Down Expand Up @@ -250,7 +255,7 @@ String
* REXML::Parsers::SAX2Parser
* Fixes wrong number of arguments of entitydecl event. Document of the event
says "an array of the entity declaration" but implementation passes two
or more arguments. It is an implementation bug but it breaks backword
or more arguments. It is an implementation bug but it breaks backward
compatibility.

* REXML::Parsers::StreamParser
Expand All @@ -271,6 +276,8 @@ String
* Improved, iterative resolver (compared to RubyGems 2.1 and earlier)
* Support for a sharing a GEM_HOME across ruby platforms and versions

* Updated to 2.2.2. Fixes some minor bugs and performance regressions.

For a complete list of enhancements and bug fixes see:
https://github.com/rubygems/rubygems/tree/master/History.txt

Expand Down
2 changes: 1 addition & 1 deletion benchmark/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def measure executable, file
cmd = "#{executable} #{@ruby_arg} #{file}"

m = Benchmark.measure{
`#{cmd}`
system(cmd, out: File::NULL)
}

if $? != 0
Expand Down
4 changes: 2 additions & 2 deletions bootstraptest/test_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -957,8 +957,8 @@ class C < B

assert_normal_exit %q{
begin
Process.setrlimit(Process::RLIMIT_STACK, 4_202_496)
# FreeBSD fails this less than 4M + 8K bytes.
Process.setrlimit(Process::RLIMIT_STACK, 4_206_592)
# FreeBSD SEGVs this less than 4M + 12K bytes.
rescue Exception
exit
end
Expand Down
2 changes: 1 addition & 1 deletion class.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
if (RB_TYPE_P(clone, T_CLASS)) {
class_init_copy_check(clone, orig);
}
rb_obj_init_copy(clone, orig);
if (!OBJ_INIT_COPY(clone, orig)) return clone;
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
RBASIC_SET_CLASS(clone, rb_singleton_class_clone(orig));
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
Expand Down
2 changes: 1 addition & 1 deletion compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
node = node->nd_next;
i += 1;
}
iseq->arg_keyword_check = (args->kw_rest_arg->nd_vid & ID_SCOPE_MASK) == ID_JUNK;
iseq->arg_keyword_check = args->kw_rest_arg->nd_cflag != 0;
iseq->arg_keywords = i;
iseq->arg_keyword_required = r;
iseq->arg_keyword_table = ALLOC_N(ID, i);
Expand Down
51 changes: 39 additions & 12 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,22 @@ if test "$GCC" = yes; then
for oflag in -fno-fast-math; do
RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(optflags, $oflag)])
done
AS_CASE(["$target"],
[*-darwin*], [
# doesn't seem necessary on Mac OS X
],
[[i[4-6]86*]], [
RUBY_TRY_CFLAGS(-msse2 -mfpmath=sse, [
RUBY_APPEND_OPTION(XCFLAGS, -msse2 -mfpmath=sse)
])
AS_CASE(["$XCFLAGS"],
[[*-msse2*]], [
RUBY_TRY_CFLAGS(-mstackrealign, [
RUBY_APPEND_OPTION(XCFLAGS, -mstackrealign)
])
])
]
)
fi

AC_ARG_WITH(opt-dir,
Expand All @@ -864,17 +880,11 @@ AC_ARG_WITH(opt-dir,
[
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //"`
CPPFLAGS="$CPPFLAGS $val"
val=`IFS="$PATH_SEPARATOR"
for dir in $withval; do
echo x ${LIBPATHFLAG} ${RPATHFLAG} |
sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g"
done | tr '\012' ' '`
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib|g;s/^ //"`
LDFLAGS="$LDFLAGS $val"
LDFLAGS_OPTDIR="$val"
test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS "
LDFLAGS="$LDFLAGS$val"
test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS "
DLDFLAGS="$DLDFLAGS$val"
])
OPT_DIR="$withval"
], [OPT_DIR=])

test -z "${ac_env_CFLAGS_set}" -a -n "${cflags+set}" && eval CFLAGS="\"$cflags $ARCH_FLAG\""
test -z "${ac_env_CXXFLAGS_set}" -a -n "${cxxflags+set}" && eval CXXFLAGS="\"$cxxflags $ARCH_FLAG\""
Expand All @@ -888,6 +898,7 @@ AC_ARG_WITH(winnt-ver,
AS_CASE(["$target_os"],
[mingw*], [
RUBY_APPEND_OPTION(CPPFLAGS, -D_WIN32_WINNT=$with_winnt_ver)
RUBY_APPEND_OPTION(CPPFLAGS, -D__MINGW_USE_VC2005_COMPAT)
])

AS_CASE(["$target_os"],
Expand Down Expand Up @@ -1040,6 +1051,7 @@ main()
if test x"$ac_cv_type_NET_LUID" = xyes; then
AC_DEFINE(HAVE_TYPE_NET_LUID, 1)
fi
AC_CHECK_FUNCS(_gmtime64_s)
AC_LIBOBJ([langinfo])
],
[os2-emx*], [ LIBS="-lm $LIBS"
Expand Down Expand Up @@ -2437,7 +2449,7 @@ if test x"$enable_pthread" = xyes; then
pthread_get_stackaddr_np pthread_get_stacksize_np \
thr_stksegment pthread_stackseg_np pthread_getthrds_np \
pthread_cond_init pthread_condattr_setclock pthread_condattr_init \
pthread_sigmask)
pthread_sigmask pthread_setname_np)
if test "${host_os}" = "nacl"; then
ac_cv_func_pthread_attr_init=no
else
Expand Down Expand Up @@ -2657,7 +2669,7 @@ if test "$with_dln_a_out" != yes; then
: ${LDSHARED='$(CC) -shared'}
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="$LDFLAGS -rdynamic"
DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@'
else
test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
fi
Expand Down Expand Up @@ -2760,6 +2772,21 @@ AC_SUBST(RPATHFLAG)
AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}")
AC_SUBST(TRY_LINK)

if test "x$OPT_DIR" != x; then
pat=`echo "${LDFLAGS_OPTDIR}" | sed ['s/[][\\.*|]/\\\\&/']`
LDFLAGS=`echo "${LDFLAGS}" | sed "s| ${pat}||"`
val=`IFS="$PATH_SEPARATOR"
for dir in $OPT_DIR; do
echo x ${LIBPATHFLAG} ${RPATHFLAG} |
sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g"
done | tr '\012' ' '`
test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS "
LDFLAGS="$LDFLAGS$val"
test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS "
DLDFLAGS="$DLDFLAGS$val"
LDFLAGS_OPTDIR="$val"
fi

AS_CASE(["$target_cpu-$target_os"],
[*-darwin*], [
AC_CHECK_HEADERS([execinfo.h])
Expand Down
12 changes: 9 additions & 3 deletions encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ must_encindex(int index)
rb_raise(rb_eEncodingError, "encoding index out of bound: %d",
index);
}
if (ENC_TO_ENCINDEX(enc) != index) {
if (ENC_TO_ENCINDEX(enc) != (int)(index & ENC_INDEX_MASK)) {
rb_raise(rb_eEncodingError, "wrong encoding index %d for %s (expected %d)",
index, rb_enc_name(enc), ENC_TO_ENCINDEX(enc));
}
Expand Down Expand Up @@ -594,12 +594,18 @@ rb_enc_from_index(int index)
if (!enc_table.list) {
rb_enc_init();
}
if (index < 0 || enc_table.count <= index) {
if (index < 0 || enc_table.count <= (index &= ENC_INDEX_MASK)) {
return 0;
}
return enc_table.list[index].enc;
}

rb_encoding *
rb_enc_get_from_index(int index)
{
return must_encindex(index);
}

int
rb_enc_registered(const char *name)
{
Expand Down Expand Up @@ -937,7 +943,7 @@ rb_obj_encoding(VALUE obj)
if (idx < 0) {
rb_raise(rb_eTypeError, "unknown encoding");
}
return rb_enc_from_encoding_index(idx);
return rb_enc_from_encoding_index(idx & ENC_INDEX_MASK);
}

int
Expand Down
4 changes: 2 additions & 2 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
VALUE cbase = 0;
void *data = 0;

if (argc > 0) {
return rb_mod_constants(argc, argv, rb_cModule);
if (argc > 0 || mod != rb_cModule) {
return rb_mod_constants(argc, argv, mod);
}

while (cref) {
Expand Down
3 changes: 1 addition & 2 deletions ext/-test-/tracepoint/tracepoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ tracepoint_track_objspace_events(VALUE self)
VALUE result = rb_ary_new();

rb_tracepoint_enable(tpval);
rb_yield(Qundef);
rb_tracepoint_disable(tpval);
rb_ensure(rb_yield, Qundef, rb_tracepoint_disable, tpval);

rb_ary_push(result, SIZET2NUM(track.newobj_count));
rb_ary_push(result, SIZET2NUM(track.free_count));
Expand Down
8 changes: 5 additions & 3 deletions ext/bigdecimal/bigdecimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,9 @@ BigDecimal_initialize_copy(VALUE self, VALUE other)
Real *pv = rb_check_typeddata(self, &BigDecimal_data_type);
Real *x = rb_check_typeddata(other, &BigDecimal_data_type);

DATA_PTR(self) = VpCopy(pv, x);
if (self != other) {
DATA_PTR(self) = VpCopy(pv, x);
}
return self;
}

Expand Down Expand Up @@ -2519,8 +2521,8 @@ BigDecimal_new(int argc, VALUE *argv)
case T_RATIONAL:
if (NIL_P(nFig)) {
rb_raise(rb_eArgError,
"can't omit precision for a %s.",
rb_class2name(CLASS_OF(iniValue)));
"can't omit precision for a %"PRIsVALUE".",
rb_obj_class(iniValue));
}
return GetVpValueWithPrec(iniValue, mf, 1);

Expand Down
5 changes: 2 additions & 3 deletions ext/dl/cptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,8 @@ rb_dlptr_inspect(VALUE self)
char str[1024];

TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
snprintf(str, 1023, "#<%s:%p ptr=%p size=%ld free=%p>",
rb_class2name(CLASS_OF(self)), data, data->ptr, data->size, data->free);
return rb_str_new2(str);
return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>",
rb_obj_class(self), data, data->ptr, data->size, data->free);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions ext/fiddle/closure.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dealloc(void * ptr)
#if USE_FFI_CLOSURE_ALLOC
ffi_closure_free(cls->pcl);
#else
munmap(cls->pcl, sizeof(cls->pcl));
munmap(cls->pcl, sizeof(*cls->pcl));
#endif
if (cls->argv) xfree(cls->argv);
xfree(cls);
Expand Down Expand Up @@ -234,7 +234,7 @@ initialize(int rbargc, VALUE argv[], VALUE self)
#else
result = ffi_prep_closure(pcl, cif, callback, (void *)self);
cl->code = (void *)pcl;
i = mprotect(pcl, sizeof(pcl), PROT_READ | PROT_EXEC);
i = mprotect(pcl, sizeof(*pcl), PROT_READ | PROT_EXEC);
if (i) {
rb_sys_fail("mprotect");
}
Expand Down
6 changes: 2 additions & 4 deletions ext/fiddle/pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,10 @@ static VALUE
rb_fiddle_ptr_inspect(VALUE self)
{
struct ptr_data *data;
char str[1024];

TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
snprintf(str, 1023, "#<%s:%p ptr=%p size=%ld free=%p>",
rb_class2name(CLASS_OF(self)), data, data->ptr, data->size, data->free);
return rb_str_new2(str);
return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>",
rb_obj_class(self), data, data->ptr, data->size, data->free);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion ext/io/console/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ console_dev(VALUE klass)
int fd;

#ifdef CONSOLE_DEVICE_FOR_WRITING
fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_WRONLY, 0);
fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_RDWR, 0);
if (fd < 0) return Qnil;
rb_update_max_fd(fd);
args[1] = INT2FIX(O_WRONLY);
Expand Down
1 change: 1 addition & 0 deletions ext/json/generator/depend
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$(OBJS): $(ruby_headers)
generator.o: generator.c generator.h $(srcdir)/../fbuffer/fbuffer.h
1 change: 1 addition & 0 deletions ext/json/generator/generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ static VALUE cState_init_copy(VALUE obj, VALUE orig)
{
JSON_Generator_State *objState, *origState;

if (obj == orig) return obj;
Data_Get_Struct(obj, JSON_Generator_State, objState);
Data_Get_Struct(orig, JSON_Generator_State, origState);
if (!objState) rb_raise(rb_eArgError, "unallocated JSON::State");
Expand Down
1 change: 1 addition & 0 deletions ext/json/parser/depend
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$(OBJS): $(ruby_headers)
parser.o: parser.c parser.h $(srcdir)/../fbuffer/fbuffer.h
18 changes: 11 additions & 7 deletions ext/openssl/ossl.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,25 +293,29 @@ ossl_to_der_if_possible(VALUE obj)
static VALUE
ossl_make_error(VALUE exc, const char *fmt, va_list args)
{
char buf[BUFSIZ];
VALUE str = Qnil;
const char *msg;
long e;
int len = 0;

#ifdef HAVE_ERR_PEEK_LAST_ERROR
e = ERR_peek_last_error();
#else
e = ERR_peek_error();
#endif
if (fmt) {
len = vsnprintf(buf, BUFSIZ, fmt, args);
str = rb_vsprintf(fmt, args);
}
if (len < BUFSIZ && e) {
if (e) {
if (dOSSL == Qtrue) /* FULL INFO */
msg = ERR_error_string(e, NULL);
else
msg = ERR_reason_error_string(e);
len += snprintf(buf+len, BUFSIZ-len, "%s%s", (len ? ": " : ""), msg);
if (NIL_P(str)) {
str = rb_str_new_cstr(msg);
}
else {
rb_str_cat2(rb_str_cat2(str, ": "), msg);
}
}
if (dOSSL == Qtrue){ /* show all errors on the stack */
while ((e = ERR_get_error()) != 0){
Expand All @@ -320,8 +324,8 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
}
ERR_clear_error();

if(len > BUFSIZ) len = rb_long2int(strlen(buf));
return rb_exc_new(exc, buf, len);
if (NIL_P(str)) str = rb_str_new(0, 0);
return rb_exc_new3(exc, str);
}

void
Expand Down
8 changes: 4 additions & 4 deletions ext/openssl/ossl.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ extern VALUE eOSSLError;
*/
#define OSSL_Check_Kind(obj, klass) do {\
if (!rb_obj_is_kind_of((obj), (klass))) {\
ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected kind of %s)",\
rb_obj_classname(obj), rb_class2name(klass));\
ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected kind of %"PRIsVALUE")",\
rb_obj_class(obj), (klass));\
}\
} while (0)

#define OSSL_Check_Instance(obj, klass) do {\
if (!rb_obj_is_instance_of((obj), (klass))) {\
ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected instance of %s)",\
rb_obj_classname(obj), rb_class2name(klass));\
ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected instance of %"PRIsVALUE")",\
rb_obj_class(obj), (klass));\
}\
} while (0)

Expand Down
Loading