From fd2bab331acfcf367e226cfae4a501bdb0a8c4f1 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Fri, 4 Nov 2011 16:00:27 +0900 Subject: [PATCH] checking for NULL values in hash_one --- lib/srfi/69/hash.c | 54 ++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/lib/srfi/69/hash.c b/lib/srfi/69/hash.c index a1fbbbd6..75e025c0 100644 --- a/lib/srfi/69/hash.c +++ b/lib/srfi/69/hash.c @@ -53,38 +53,40 @@ static sexp_uint_t hash_one (sexp ctx, sexp obj, sexp_uint_t bound, sexp_sint_t sexp t, *p; char *p0; loop: + if (obj) { #if SEXP_USE_FLONUMS - if (sexp_flonump(obj)) - acc ^= (sexp_sint_t) sexp_flonum_value(obj); - else + if (sexp_flonump(obj)) + acc ^= (sexp_sint_t) sexp_flonum_value(obj); + else #endif - if (sexp_pointerp(obj)) { - if (depth) { - t = sexp_object_type(ctx, obj); - p = (sexp*) (((char*)obj) + sexp_type_field_base(t)); - p0 = ((char*)obj) + offsetof(struct sexp_struct, value); - if ((sexp)p == obj) p=(sexp*)p0; - /* hash trailing non-object data */ - size = sexp_type_size_of_object(t, obj)-offsetof(struct sexp_struct, value); - p0 = ((char*)p + sexp_type_num_slots_of_object(t,obj)*sizeof(sexp)); - if (((char*)obj + size) > p0) - for (i=0; i 0) { - depth--; - for (i=0; i p0) + for (i=0; i 0) { + depth--; + for (i=0; i