Hackfut Security File Manager
Current Path:
/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/oj-3.7.12/ext/oj
opt
/
td-agent
/
embedded
/
lib
/
ruby
/
gems
/
2.4.0
/
gems
/
oj-3.7.12
/
ext
/
oj
/
📁
..
📄
.sitearchdir.-.oj.time
(0 B)
📄
Makefile
(9.43 KB)
📄
buf.h
(3.07 KB)
📄
cache8.c
(2.11 KB)
📄
cache8.h
(1.93 KB)
📄
circarray.c
(1.25 KB)
📄
circarray.h
(579 B)
📄
code.c
(5.2 KB)
📄
code.h
(974 B)
📄
compat.c
(8.35 KB)
📄
custom.c
(31.7 KB)
📄
dump.c
(29.51 KB)
📄
dump.h
(2.8 KB)
📄
dump_compat.c
(26.02 KB)
📄
dump_leaf.c
(5.47 KB)
📄
dump_object.c
(20.4 KB)
📄
dump_strict.c
(11.08 KB)
📄
encode.h
(1.78 KB)
📄
err.c
(1.24 KB)
📄
err.h
(2.53 KB)
📄
extconf.rb
(1.19 KB)
📄
fast.c
(42.43 KB)
📄
hash.c
(4.11 KB)
📄
hash.h
(1.9 KB)
📄
hash_test.c
(16.02 KB)
📄
mimic_json.c
(25.65 KB)
📄
object.c
(19.56 KB)
📄
odd.c
(5.37 KB)
📄
odd.h
(1.08 KB)
📄
oj.c
(69.29 KB)
📄
oj.h
(9.93 KB)
📄
oj.so
(1.08 MB)
📄
parse.c
(27.28 KB)
📄
parse.h
(3 KB)
📄
rails.c
(38.54 KB)
📄
rails.h
(392 B)
📄
reader.c
(6.06 KB)
📄
reader.h
(2.84 KB)
📄
resolve.c
(2.35 KB)
📄
resolve.h
(351 B)
📄
rxclass.c
(2.96 KB)
📄
rxclass.h
(653 B)
📄
saj.c
(17.11 KB)
📄
scp.c
(5.54 KB)
📄
sparse.c
(22.78 KB)
📄
stream_writer.c
(10.16 KB)
📄
strict.c
(5.4 KB)
📄
string_writer.c
(13.4 KB)
📄
trace.c
(2.08 KB)
📄
trace.h
(838 B)
📄
util.c
(3.37 KB)
📄
util.h
(313 B)
📄
val_stack.c
(3.63 KB)
📄
val_stack.h
(4.79 KB)
📄
wab.c
(15.25 KB)
Editing: resolve.c
/* resolve.c * Copyright (c) 2012, Peter Ohler * All rights reserved. */ #include <stdlib.h> #include <stdio.h> #include <string.h> #if HAVE_LIBPTHREAD #include <pthread.h> #endif #include "oj.h" #include "err.h" #include "parse.h" #include "hash.h" inline static VALUE resolve_classname(VALUE mod, const char *classname, int auto_define) { VALUE clas; ID ci = rb_intern(classname); if (rb_const_defined_at(mod, ci)) { clas = rb_const_get_at(mod, ci); } else if (auto_define) { clas = rb_define_class_under(mod, classname, oj_bag_class); } else { clas = Qundef; } return clas; } static VALUE resolve_classpath(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) { char class_name[1024]; VALUE clas; char *end = class_name + sizeof(class_name) - 1; char *s; const char *n = name; clas = rb_cObject; for (s = class_name; 0 < len; n++, len--) { if (':' == *n) { *s = '\0'; n++; len--; if (':' != *n) { return Qundef; } if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) { return Qundef; } s = class_name; } else if (end <= s) { return Qundef; } else { *s++ = *n; } } *s = '\0'; if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) { oj_set_error_at(pi, error_class, __FILE__, __LINE__, "class %s is not defined", name); if (Qnil != error_class) { pi->err_class = error_class; } } return clas; } VALUE oj_name2class(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) { VALUE clas; VALUE *slot; if (No == pi->options.class_cache) { return resolve_classpath(pi, name, len, auto_define, error_class); } #if HAVE_LIBPTHREAD pthread_mutex_lock(&oj_cache_mutex); #else rb_mutex_lock(oj_cache_mutex); #endif if (Qnil == (clas = oj_class_hash_get(name, len, &slot))) { if (Qundef != (clas = resolve_classpath(pi, name, len, auto_define, error_class))) { *slot = clas; } } #if HAVE_LIBPTHREAD pthread_mutex_unlock(&oj_cache_mutex); #else rb_mutex_unlock(oj_cache_mutex); #endif return clas; } VALUE oj_name2struct(ParseInfo pi, VALUE nameVal, VALUE error_class) { size_t len = RSTRING_LEN(nameVal); const char *str = StringValuePtr(nameVal); return resolve_classpath(pi, str, len, 0, error_class); }
Upload File
Create Folder