pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.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: pike_types.c,v 1.223 2003/09/09 14:31:00 mast Exp $ + || $Id: pike_types.c,v 1.224 2003/11/09 01:10:14 mast Exp $   */      #include "global.h" - RCSID("$Id: pike_types.c,v 1.223 2003/09/09 14:31:00 mast Exp $"); + RCSID("$Id: pike_types.c,v 1.224 2003/11/09 01:10:14 mast Exp $");   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"   #include "constants.h"   #include "object.h"   #include "multiset.h"
pike.git/src/pike_types.c:1787:    }   }      void my_describe_type(struct pike_type *type)   {    low_describe_type(type);   }      struct pike_string *describe_type(struct pike_type *type)   { +  dynamic_buffer save_buf;    check_type_string(type);    if(!type) return make_shared_string("mixed"); -  init_buf(); +  init_buf(&save_buf);    low_describe_type(type); -  return free_buf(); +  return free_buf(&save_buf);   }         /******/      static int low_is_same_type(struct pike_type *a, struct pike_type *b)   {    return a == b;   }   
pike.git/src/pike_types.c:2196: Inside #if defined(PIKE_TYPE_DEBUG)
   int flags)   #ifdef PIKE_TYPE_DEBUG   {    int e;    char *s;    static struct pike_type *low_match_types2(struct pike_type *a,    struct pike_type *b,    int flags);       if (l_flag>2) { -  init_buf(); +  dynamic_buffer save_buf; +  init_buf(&save_buf);    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat("low_match_types(");    my_describe_type(a);    my_strcat(",\n");    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat(" ");    my_describe_type(b);    my_strcat(",\n");    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat(" ");
pike.git/src/pike_types.c:2239: Inside #if defined(PIKE_TYPE_DEBUG)
   if (f) {    my_strcat(" | ");    }    my_strcat("NO_SHORTCUTS");    f = 1;    }    } else {    my_strcat("0");    }    my_strcat(");\n"); -  fprintf(stderr,"%s",(s=simple_free_buf())); +  fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    indent++;    }       a = low_match_types2(a, b, flags);       if (l_flag>2) { -  +  dynamic_buffer save_buf;    indent--; -  init_buf(); +  init_buf(&save_buf);    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat("= ");    if(a)    my_describe_type(a);    else    my_strcat("NULL");    my_strcat("\n"); -  fprintf(stderr,"%s",(s=simple_free_buf())); +  fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    }    return a;   }      static struct pike_type *low_match_types2(struct pike_type *a,    struct pike_type *b,    int flags)   #endif   
pike.git/src/pike_types.c:2326:    tmp = pop_unfinished_type();       type_stack_mark();    low_or_pike_types(a_markers[m], tmp, 0);    if(a_markers[m]) free_type(a_markers[m]);    free_type(tmp);    a_markers[m] = pop_unfinished_type();      #ifdef PIKE_TYPE_DEBUG    if (l_flag>2) { +  dynamic_buffer save_buf;    char *s;    int e; -  init_buf(); +  init_buf(&save_buf);    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat("a_markers[");    my_putchar((char)(m+'0'));    my_strcat("]=");    my_describe_type(a_markers[m]);    my_strcat("\n"); -  fprintf(stderr,"%s",(s=simple_free_buf())); +  fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    }   #endif   #ifdef PIKE_DEBUG    if(a_markers[m]->type == m+'0')    Pike_fatal("Cyclic type!\n");   #endif    }    return ret;   
pike.git/src/pike_types.c:2412:    push_finished_type_with_markers(a, a_markers);    tmp=pop_unfinished_type();       type_stack_mark();    low_or_pike_types(b_markers[m], tmp, 0);    if(b_markers[m]) free_type(b_markers[m]);    free_type(tmp);    b_markers[m] = pop_unfinished_type();   #ifdef PIKE_TYPE_DEBUG    if (l_flag>2) { +  dynamic_buffer save_buf;    char *s;    int e; -  init_buf(); +  init_buf(&save_buf);    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat("b_markers[");    my_putchar((char)(m+'0'));    my_strcat("]=");    my_describe_type(b_markers[m]);    my_strcat("\n"); -  fprintf(stderr,"%s",(s=simple_free_buf())); +  fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    }   #endif   #ifdef PIKE_DEBUG    if(b_markers[m]->type == m+'0')    Pike_fatal("Cyclic type!\n");   #endif    }    return ret;   
pike.git/src/pike_types.c:2746: Inside #if defined(PIKE_TYPE_DEBUG)
  #ifdef PIKE_TYPE_DEBUG   {    int e;    char *s;    static int low_pike_types_le2(struct pike_type *a, struct pike_type *b,    int array_cnt, unsigned int flags);    int res;    char buf[50];       if (l_flag>2) { -  init_buf(); +  dynamic_buffer save_buf; +  init_buf(&save_buf);    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat("low_pike_types_le(");    my_describe_type(a);    my_strcat(",\n");    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat(" ");    my_describe_type(b);    my_strcat(",\n");    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat(" ");    sprintf(buf, "%d", array_cnt);    my_strcat(buf);    my_strcat(", ");    sprintf(buf, "0x%08x", flags);    my_strcat(buf);    my_strcat(");\n"); -  fprintf(stderr,"%s",(s=simple_free_buf())); +  fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    indent++;    }       res = low_pike_types_le2(a, b, array_cnt, flags);       if (l_flag>2) {    indent--;       for(e=0;e<indent;e++) fprintf(stderr, " ");
pike.git/src/pike_types.c:2870:    push_type(T_ARRAY);    tmp=pop_unfinished_type();       type_stack_mark();    low_or_pike_types(a_markers[m], tmp, 0);    if(a_markers[m]) free_type(a_markers[m]);    free_type(tmp);    a_markers[m] = pop_unfinished_type();   #ifdef PIKE_TYPE_DEBUG    if (l_flag>2) { +  dynamic_buffer save_buf;    char *s;    int e; -  init_buf(); +  init_buf(&save_buf);    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat("a_markers[");    my_putchar((char)(m+'0'));    my_strcat("]=");    my_describe_type(a_markers[m]);    my_strcat("\n"); -  fprintf(stderr,"%s",(s=simple_free_buf())); +  fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    }   #endif    }    return ret;       case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int m = a->type - '0';
pike.git/src/pike_types.c:2954:    push_type(T_ARRAY);    tmp=pop_unfinished_type();       type_stack_mark();    low_or_pike_types(b_markers[m], tmp, 0);    if(b_markers[m]) free_type(b_markers[m]);    free_type(tmp);    b_markers[m]=pop_unfinished_type();   #ifdef PIKE_TYPE_DEBUG    if (l_flag>2) { +  dynamic_buffer save_buf;    char *s;    int e; -  init_buf(); +  init_buf(&save_buf);    for(e=0;e<indent;e++) my_strcat(" ");    my_strcat("b_markers[");    my_putchar((char)(m+'0'));    my_strcat("]=");    my_describe_type(b_markers[m]);    my_strcat("\n"); -  fprintf(stderr,"%s",(s=simple_free_buf())); +  fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    }   #endif    }    return ret;       case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int m = b->type - '0';
pike.git/src/pike_types.c:4837:    goto recurse;       default:    Pike_error("low_type_to_string(): Unsupported node: %d\n", t->type);    break;    }   }      struct pike_string *type_to_string(struct pike_type *t)   { -  init_buf(); +  dynamic_buffer save_buf; +  init_buf(&save_buf);    low_type_to_string(t); -  return free_buf(); +  return free_buf(&save_buf);   }      void init_types(void)   {    /* Initialize hashtable here. */    pike_type_hash = (struct pike_type **)xalloc(sizeof(struct pike_type *) *    PIKE_TYPE_HASH_SIZE);    MEMSET(pike_type_hash, 0, sizeof(struct pike_type *) * PIKE_TYPE_HASH_SIZE);    pike_type_hash_size = PIKE_TYPE_HASH_SIZE;    init_pike_type_blocks();