static TDHS_INLINE uint64_t calc_hash_keys(uint32_t key_num,
		const tdhs_get_key_t* key) {
	uint64_t hash = 0;
	for (uint32_t i = 0; i < key_num; i++) {
		if (hash) {
			hash = fold(hash, calc_hash_key(key[i]));
		} else {
			hash = calc_hash_key(key[i]);
		}
	}
	return hash;
}
Example #2
0
File: strict.c Project: ebenoist/oj
static void
hash_set_cstr(ParseInfo pi, Val parent, const char *str, size_t len, const char *orig) {
    volatile VALUE	rstr = rb_str_new(str, len);

    rstr = oj_encode(rstr);
    rb_hash_aset(stack_peek(&pi->stack)->val, calc_hash_key(pi, parent), rstr);
}
Example #3
0
File: strict.c Project: ebenoist/oj
static void
hash_set_num(struct _ParseInfo *pi, Val parent, NumInfo ni) {
    if (ni->infinity || ni->nan) {
	oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "not a number or other value");
    }
    rb_hash_aset(stack_peek(&pi->stack)->val, calc_hash_key(pi, parent), oj_num_as_value(ni));
}
Example #4
0
File: strict.c Project: skaes/oj
static void
hash_set_value(ParseInfo pi, Val parent, VALUE value) {
    rb_hash_aset(stack_peek(&pi->stack)->val, calc_hash_key(pi, parent), value);
    if (Yes == pi->options.trace) {
	oj_trace_parse_call("set_value", pi, __FILE__, __LINE__, value);
    }
}
Example #5
0
File: strict.c Project: skaes/oj
static void
hash_set_cstr(ParseInfo pi, Val parent, const char *str, size_t len, const char *orig) {
    volatile VALUE	rstr = rb_str_new(str, len);

    rstr = oj_encode(rstr);
    rb_hash_aset(stack_peek(&pi->stack)->val, calc_hash_key(pi, parent), rstr);
    if (Yes == pi->options.trace) {
	oj_trace_parse_call("set_string", pi, __FILE__, __LINE__, rstr);
    }
}
Example #6
0
File: strict.c Project: skaes/oj
static void
hash_set_num(struct _ParseInfo *pi, Val parent, NumInfo ni) {
    volatile VALUE	v;
    
    if (ni->infinity || ni->nan) {
	oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "not a number or other value");
    }
    v = oj_num_as_value(ni);
    rb_hash_aset(stack_peek(&pi->stack)->val, calc_hash_key(pi, parent), v);
    if (Yes == pi->options.trace) {
	oj_trace_parse_call("set_number", pi, __FILE__, __LINE__, v);
    }
}
Example #7
0
File: strict.c Project: ebenoist/oj
static void
hash_set_value(ParseInfo pi, Val parent, VALUE value) {
    rb_hash_aset(stack_peek(&pi->stack)->val, calc_hash_key(pi, parent), value);
}