Skip to content

Commit ee53e38

Browse files
committed
fix: valgrind config
1 parent de4ce5d commit ee53e38

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if RUBY_VERSION >= "2.5"
2828
require "ruby_memcheck"
2929
require "ruby_memcheck/rspec/rake_task"
3030

31-
RubyMemcheck.config(skipped_ruby_functions: %w[rb_utf8_str_new_cstr rb_exc_new_str])
31+
RubyMemcheck.config(skipped_ruby_functions: %w[rb_utf8_str_new_cstr rb_exc_new_str rb_exc_raise])
3232
namespace :spec do
3333
RubyMemcheck::RSpec::RakeTask.new(valgrind: :compile)
3434
end

ext/json_scanner/json_scanner.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ typedef enum
266266
} value_type;
267267

268268
// noexcept
269-
volatile VALUE create_point(scan_ctx *sctx, value_type type, size_t length, size_t curr_pos)
269+
VALUE create_point(scan_ctx *sctx, value_type type, size_t length, size_t curr_pos)
270270
{
271271
VALUE values[3];
272272
volatile VALUE point = rb_ary_new_capa(3);
@@ -306,7 +306,7 @@ volatile VALUE create_point(scan_ctx *sctx, value_type type, size_t length, size
306306
}
307307

308308
// noexcept
309-
volatile VALUE create_path(scan_ctx *sctx)
309+
VALUE create_path(scan_ctx *sctx)
310310
{
311311
volatile VALUE path = rb_ary_new_capa(sctx->current_path_len);
312312
for (int i = 0; i < sctx->current_path_len; i++)
@@ -337,7 +337,7 @@ void save_point(scan_ctx *sctx, value_type type, size_t length)
337337
// TODO: Abort parsing if all paths are matched and no more mathces are possible: only trivial key/index matchers at the current level
338338
// TODO: Don't re-compare already matched prefixes; hard to invalidate, though
339339
// TODO: Might fail in case of no memory
340-
volatile VALUE point = Qundef;
340+
volatile VALUE point = Qundef, path;
341341
int match;
342342
for (int i = 0; i < sctx->paths_len; i++)
343343
{
@@ -381,7 +381,8 @@ void save_point(scan_ctx *sctx, value_type type, size_t length)
381381
point = create_point(sctx, type, length, yajl_get_bytes_consumed(sctx->handle));
382382
if (sctx->with_path)
383383
{
384-
point = rb_ary_new_from_args(2, create_path(sctx), point);
384+
path = create_path(sctx);
385+
point = rb_ary_new_from_args(2, path, point);
385386
}
386387
}
387388
// rb_ary_push raises only in case of a frozen array, which is not the case

0 commit comments

Comments
 (0)