From: Stefan Kaes Date: 2005-07-15T03:18:52+09:00 Subject: Re: GC tweak --------------060701000105000006060405 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mathieu Bouchard wrote: >On Thu, 14 Jul 2005, Stefan Kaes wrote: > > >>Any comments? >> >> > >isn't the following a bit more straightforward? > >static void set_gc_param(int *var, const char *name) { > char *p = getenv(name); > if (p) { > int i = atoi(p); > if (i>0) *var = i; > } >} >static void set_gc_parameters(void) { > set_gc_param(heap_min_slots, "RUBY_HEAP_MIN_SLOTS"); > set_gc_param(heap_free_min, "RUBY_HEAP_FREE_MIN"); > set_gc_param(heaps_increment,"RUBY_HEAP_INCREMENT"); > set_gc_param(gc_stats, "RUBY_GC_STATS"); > set_gc_param(malloc_limit, "RUBY_GC_MALLOC_LIMIT"); > heap_slots = heap_min_slots; >} > > > Certainly. If you make it "&heap_min_slots" etc. in the calls to set_gc_param ;-) But then you will loose the ability to do any option specific processing. -- stefan --------------060701000105000006060405--