Hi, I don't understand the purpose of wdcache and wlcache. The "nc" field seems to be always 0 (as initialized in ocache_create(), and I don't find where it is increased. But `ocache_alloc()` just call xmalloc without using the cache since nc is 0. So wdcache and wlcache seem to be useless.
Do I miss something? http://git.savannah.gnu.org/cgit/bash.git/tree/make_cmd.c#n52 sh_obj_cache_t wdcache = {0, 0, 0}; sh_obj_cache_t wlcache = {0, 0, 0}; http://git.savannah.gnu.org/cgit/bash.git/tree/make_cmd.c#n64 void cmd_init () { ocache_create (wdcache, WORD_DESC, WDCACHESIZE); ocache_create (wlcache, WORD_LIST, WLCACHESIZE); } http://git.savannah.gnu.org/cgit/bash.git/tree/include/ocache.h#n55 typedef struct objcache { PTR_T data; int cs; /* cache size, number of objects */ int nc; /* number of cache entries */ } sh_obj_cache_t; http://git.savannah.gnu.org/cgit/bash.git/tree/include/ocache.h#n29 # define PTR_T char * http://git.savannah.gnu.org/cgit/bash.git/tree/include/ocache.h#n61 /* Create an object cache C of N pointers to OTYPE. */ #define ocache_create(c, otype, n) \ do { \ (c).data = xmalloc((n) * sizeof (otype *)); \ (c).cs = (n); \ (c).nc = 0; \ } while (0) http://git.savannah.gnu.org/cgit/bash.git/tree/include/ocache.h#n90 #define ocache_alloc(c, otype, r) \ do { \ if ((c).nc > 0) { \ (r) = (otype *)((otype **)((c).data))[--(c).nc]; \ } else \ (r) = (otype *)xmalloc (sizeof (otype)); \ } while (0) -- Regards, Peng