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: cache8.c
#include <stdlib.h> #include <errno.h> #include <stdio.h> #include <string.h> #include <stdarg.h> #include "ruby.h" #include "cache8.h" #define BITS 4 #define MASK 0x000000000000000FULL #define SLOT_CNT 16 #define DEPTH 16 typedef union { struct _cache8 *child; slot_t value; } Bucket; struct _cache8 { Bucket buckets[SLOT_CNT]; }; static void cache8_delete(Cache8 cache, int depth); static void slot_print(Cache8 cache, sid_t key, unsigned int depth); void oj_cache8_new(Cache8 *cache) { Bucket *b; int i; *cache = ALLOC(struct _cache8); for (i = SLOT_CNT, b = (*cache)->buckets; 0 < i; i--, b++) { b->value = 0; } } void oj_cache8_delete(Cache8 cache) { cache8_delete(cache, 0); } static void cache8_delete(Cache8 cache, int depth) { Bucket *b; unsigned int i; for (i = 0, b = cache->buckets; i < SLOT_CNT; i++, b++) { if (0 != b->child) { if (DEPTH - 1 != depth) { cache8_delete(b->child, depth + 1); } } } xfree(cache); } slot_t oj_cache8_get(Cache8 cache, sid_t key, slot_t **slot) { Bucket *b; int i; sid_t k8 = (sid_t)key; sid_t k; for (i = 64 - BITS; 0 < i; i -= BITS) { k = (k8 >> i) & MASK; b = cache->buckets + k; if (0 == b->child) { oj_cache8_new(&b->child); } cache = b->child; } *slot = &(cache->buckets + (k8 & MASK))->value; return **slot; } void oj_cache8_print(Cache8 cache) { /*printf("-------------------------------------------\n"); */ slot_print(cache, 0, 0); } static void slot_print(Cache8 c, sid_t key, unsigned int depth) { Bucket *b; unsigned int i; sid_t k8 = (sid_t)key; sid_t k; for (i = 0, b = c->buckets; i < SLOT_CNT; i++, b++) { if (0 != b->child) { k = (k8 << BITS) | i; /*printf("*** key: 0x%016llx depth: %u i: %u\n", k, depth, i); */ if (DEPTH - 1 == depth) { #if IS_WINDOWS printf("0x%016lx: %4lu\n", (long unsigned int)k, (long unsigned int)b->value); #else printf("0x%016llx: %4llu\n", (long long unsigned int)k, (long long unsigned int)b->value); #endif } else { slot_print(b->child, k, depth + 1); } } } }
Upload File
Create Folder