pike.git / src / constants.c

version» Context lines:

pike.git/src/constants.c:9:   #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_allocator.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)   {    return builtin_constants;   }
pike.git/src/constants.c:61:    free_string(key);   }      PMOD_EXPORT void add_global_program(const char *name, struct program *p)   {    struct svalue s;    SET_SVAL(s, T_PROGRAM, 0, program, p);    low_add_constant(name, p?&s:NULL);   }    - #undef EXIT_BLOCK - #define EXIT_BLOCK(X) do { \ -  DO_IF_DEBUG (DOUBLEUNLINK (first_callable, X)); \ -  free_type(X->type); \ -  free_string(X->name); \ -  X->name=0; \ -  EXIT_PIKE_MEMOBJ(X); \ - }while(0) -  - #include "block_allocator.h" +    static struct block_allocator callable_allocator    = BA_INIT_PAGES(sizeof(struct callable), 2);      void really_free_callable(struct callable * c) { -  EXIT_BLOCK(c); + #ifdef PIKE_DEBUG +  DOUBLEUNLINK (first_callable, c); + #endif +  free_type(c->type); +  free_string(c->name); +  c->name=0; +  EXIT_PIKE_MEMOBJ(c);    ba_free(&callable_allocator, c);   } -  +    void count_memory_in_callables(size_t * num, size_t * size) {    ba_count_all(&callable_allocator, num, size);   }   void free_all_callable_blocks() {    ba_destroy(&callable_allocator);   }      int global_callable_flags=0;      /* Eats one ref to 'type' and 'name' */