Branch: Tag:

2002-01-27

2002-01-27 18:25:43 by Martin Stjernholm <mast@lysator.liu.se>

Init the builtin_constants mapping once at startup instead of on demand.
This saves a couple of cycles, but more importantly it avoids the mapping
being created again after dmalloc-cleanup, which can happen e.g. when the
gc tries to get at the master object.

Rev: src/constants.c:1.35
Rev: src/constants.h:1.21
Rev: src/main.c:1.146

17:   #include "security.h"   #include "block_alloc.h"    - RCSID("$Id: constants.c,v 1.34 2002/01/16 02:54:09 nilsson Exp $"); + RCSID("$Id: constants.c,v 1.35 2002/01/27 18:25:43 mast Exp $");      struct mapping *builtin_constants = 0;      PMOD_EXPORT struct mapping *get_builtin_constants(void)   { -  if(!builtin_constants) -  builtin_constants=allocate_mapping(20); -  +     return builtin_constants;   }   
33:   {    struct svalue s;    -  if(!builtin_constants) -  builtin_constants=allocate_mapping(20); -  +     s.type=T_STRING;    s.subtype=0;    s.u.string=name;
192:   }   #endif    + void init_builtin_constants(void) + { +  builtin_constants = allocate_mapping(20); + } +    void cleanup_added_efuns(void)   {   #ifdef DO_PIKE_CLEANUP