pike.git / src / constants.c

version» Context lines:

pike.git/src/constants.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: constants.c,v 1.58 2008/04/26 16:07:39 grubba Exp $ + || $Id: constants.c,v 1.59 2008/05/11 02:35:22 mast Exp $   */      #include "global.h"   #include "constants.h"   #include "pike_macros.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "pike_memory.h"   #include "interpret.h"   #include "mapping.h"   #include "pike_error.h"   #include "pike_security.h" -  + #include "gc.h" +    #include "block_alloc.h"      struct mapping *builtin_constants = 0;      #ifdef PIKE_DEBUG   struct callable *first_callable = NULL;   #endif      PMOD_EXPORT struct mapping *get_builtin_constants(void)   {
pike.git/src/constants.c:181:    s.type=T_FUNCTION;    s.subtype=FUNCTION_BUILTIN;    add_ref(n);    ret=s.u.efun=low_make_callable(fun, n, t, flags, optimize, docode);    mapping_string_insert(builtin_constants, n, &s);    free_svalue(&s);    free_string(n);    return ret;   }    + void visit_callable (struct callable *c, int action) + { +  switch (action) {   #ifdef PIKE_DEBUG -  +  default: +  Pike_fatal ("Unknown visit action %d.\n", action); +  case VISIT_NORMAL: +  case VISIT_COMPLEX_ONLY: +  break; + #endif +  case VISIT_COUNT_BYTES: +  mc_counted_bytes += sizeof (struct callable); +  break; +  } +  +  if (!(action & VISIT_COMPLEX_ONLY)) { +  visit_type_ref (c->type, REF_TYPE_NORMAL); +  visit_string_ref (c->name, REF_TYPE_NORMAL); +  } +  +  /* Looks like the c->prog isn't refcounted..? */ +  /* visit_program_ref (c->prog, REF_TYPE_NORMAL); */ + } +  + #ifdef PIKE_DEBUG   void present_constant_profiling(void)   {    struct callable_block *b;    size_t e;    for(b=callable_blocks;b;b=b->next)    {    for(e=0;e<NELEM(b->x);e++)    {    if(b->x[e].name)    {