From: Matthew Mondor Date: Sun, 6 Sep 2015 11:47:12 +0000 (-0400) Subject: - si_get_limit() must deal with size_t for heap-size too X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=922b8a3e3db5cb8f0514c0729506b5cd4283c21c;p=ecl.git - si_get_limit() must deal with size_t for heap-size too - add comments for the size_t exceptions --- diff --git a/src/c/stacks.d b/src/c/stacks.d index af42f2a..c93426a 100644 --- a/src/c/stacks.d +++ b/src/c/stacks.d @@ -638,6 +638,10 @@ si_set_limit(cl_object type, cl_object limit) cl_index the_size = ecl_to_size(limit); ecl_stack_set_size(env, the_size); } else { + /* + * size_t can be larger than cl_index, and ecl_to_size() + * creates a fixnum which is too small for size_t on 32-bit. + */ size_t the_size = (size_t)ecl_to_ulong(limit); _ecl_set_max_heap_size(fix_heap_size(the_size)); } @@ -659,7 +663,8 @@ si_get_limit(cl_object type) else if (type == @'ext::lisp-stack') output = env->stack_limit_size; else - output = cl_core.max_heap_size; + /* size_t can be larger than cl_index */ + @(return ecl_make_unsigned_integer(cl_core.max_heap_size)); @(return ecl_make_unsigned_integer(output)) }