Ejemplo n.º 1
0
Archivo: type.c Proyecto: michelf/dmd
type *type_alloc_template(symbol *s)
{   type *t;

#if TX86
    t = (type *) mem_fcalloc(sizeof(typetemp_t));
#else
    t = (type *) MEM_PH_MALLOC(sizeof(typetemp_t));
    memset(t, 0, sizeof(typetemp_t));
#endif
    t->Tty = TYtemplate;
    if (s->Stemplate->TMprimary)
        s = s->Stemplate->TMprimary;
    ((typetemp_t *)t)->Tsym = s;
#if SRCPOS_4TYPES
    if (PARSER && config.fulltypes)
        t->Tsrcpos = getlinnum();
#endif
#ifdef DEBUG
    t->id = IDtype;
    type_num++;
    if (type_num > type_max)
        type_max = type_num;
    //dbg_printf("Alloc'ing template type %p ",t); WRTYxx(t->Tty); dbg_printf("\n");
#endif
    return t;
}
Ejemplo n.º 2
0
Archivo: dt.c Proyecto: Govelius/dmd
dt_t *dt_calloc(char dtx)
{
    dt_t *dt;
    static dt_t dtzero;

    if (dt_freelist)
    {
        dt = dt_freelist;
        dt_freelist = dt->DTnext;
        *dt = dtzero;
    }
    else
        dt = (dt_t *) mem_fcalloc(sizeof(dt_t));
    dt->dt = dtx;
    return dt;
}