Branch: Tag:

1998-01-25

1998-01-25 08:28:45 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

jumbopatch! (DEBUG_MALLOC + parent feature fix)

Rev: src/ChangeLog:1.130
Rev: src/acconfig.h:1.15
Rev: src/array.c:1.22
Rev: src/array.h:1.6
Rev: src/builtin_functions.c:1.62
Rev: src/builtin_functions.h:1.6
Rev: src/cpp.c:1.14
Rev: src/dmalloc.h:1.1
Rev: src/docode.c:1.25
Rev: src/dynamic_buffer.c:1.6
Rev: src/dynamic_buffer.h:1.4
Rev: src/error.c:1.10
Rev: src/error.h:1.9
Rev: src/fdlib.c:1.9
Rev: src/gc.c:1.27
Rev: src/global.h:1.13
Rev: src/interpret.c:1.61
Rev: src/language.yacc:1.54
Rev: src/las.c:1.43
Rev: src/las.h:1.11
Rev: src/lex.c:1.40
Rev: src/lex.h:1.9
Rev: src/main.c:1.35
Rev: src/main.h:1.4
Rev: src/mapping.c:1.27
Rev: src/mapping.h:1.7
Rev: src/module.c:1.7
Rev: src/modules/Image/colortable.c:1.36
Rev: src/modules/Image/encodings/gif.c:1.30
Rev: src/modules/Image/encodings/png.c:1.2
Rev: src/modules/Image/encodings/pnm.c:1.12
Rev: src/modules/Image/encodings/x.c:1.5
Rev: src/modules/Yp/yp.c:1.10
Rev: src/modules/files/efuns.c:1.44
Rev: src/modules/files/file.c:1.69
Rev: src/modules/files/socket.c:1.25
Rev: src/modules/files/socktest.pike:1.7
Rev: src/modules/spider/accesseddb.c:1.13
Rev: src/modules/spider/dumudp.c:1.32
Rev: src/modules/spider/spider.c:1.51
Rev: src/modules/system/system.c:1.39
Rev: src/multiset.c:1.9
Rev: src/object.c:1.33
Rev: src/peep.c:1.17
Rev: src/pike_memory.c:1.4
Rev: src/pike_memory.h:1.2
Rev: src/pike_types.c:1.29
Rev: src/pike_types.h:1.7
Rev: src/program.c:1.54
Rev: src/program.h:1.27
Rev: src/stralloc.c:1.24
Rev: src/stralloc.h:1.12
Rev: src/testsuite.in:1.68
Rev: src/threads.c:1.53

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: mapping.c,v 1.26 1998/01/13 01:51:28 grubba Exp $"); + RCSID("$Id: mapping.c,v 1.27 1998/01/25 08:25:10 hubbe Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"
624:       ai=mapping_indices(a);    av=mapping_values(a); +  if(ai->size > 1) +  {    zipper=get_set_order(ai);    order_array(ai, zipper);    order_array(av, zipper);    free((char *)zipper); -  +  }       bi=mapping_indices(b);    bv=mapping_values(b); -  +  if(bi->size > 1) +  {    zipper=get_set_order(bi);    order_array(bi, zipper);    order_array(bv, zipper);    free((char *)zipper); -  +  }       zipper=merge(ai,bi,op);   
714:   void describe_mapping(struct mapping *m,struct processing *p,int indent)   {    struct processing doing; -  INT32 e,d; +  INT32 e,d,q;    struct keypair *k;    char buf[40];   
739:    sprintf(buf,"([ /* %ld elements */\n",(long) m->size);    my_strcat(buf);    -  d=0; +  q=0;       LOOP(m)    { -  if(d) +  if(q)    { -  my_strcat(",\n"); +  my_putchar(','); +  my_putchar('\n');    } else { -  d=1; +  q=1;    }    for(d=0; d<indent; d++) my_putchar(' ');    describe_svalue(& k->ind, indent+2, p);
938: Inside #if defined(DEBUG)
   if(m->size > (m->hashsize + 3) * AVG_LINK_LENGTH)    fatal("Pretty mean hashtable there buster!.\n");    -  if(m->size < (m->hashsize - 3) * MIN_LINK_LENGTH) -  fatal("Hashsize is too small for mapping.\n"); -  +     if(m->size > 0 && (!m->ind_types || !m->val_types))    fatal("Mapping type fields are... wrong.\n");   
1065:    }   }    + #ifdef DEBUG +  + void simple_describe_mapping(struct mapping *m) + { +  char *s; +  init_buf(); +  describe_mapping(m,0,2); +  s=simple_free_buf(); +  fprintf(stderr,"%s\n",s); +  free(s); + } +  +  + void debug_dump_mapping(struct mapping *m) + { +  fprintf(stderr,"Refs=%d, next=%p, prev=%p, size=%d, hashsize=%d\n", +  m->refs, +  m->next, +  m->prev, +  m->size, +  m->hashsize); +  fprintf(stderr,"Indices type field = "); +  debug_dump_type_field(m->ind_types); +  fprintf(stderr,"\n"); +  fprintf(stderr,"Values type field = "); +  debug_dump_type_field(m->val_types); +  fprintf(stderr,"\n"); +  simple_describe_mapping(m); + } + #endif +    void zap_all_mappings(void)   {    INT32 e;
1075:    {    m->refs++;    + #if defined(DEBUG) && defined(DEBUG_MALLOC) +  if(verbose_debug_exit) +  debug_dump_mapping(m); + #endif +     for(e=0;e<m->hashsize;e++)    {    while((k=m->hash[e]))