pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:2476:      struct used_vars   {    int err;    int ext_flags;    /* Note that the locals and externals linked lists are sorted on scope_id. */    struct scope_info *locals; /* Lexical scopes. scope_id == depth */    struct scope_info *externals; /* External scopes. scope_id == program_id */   };    - #define VAR_BLOCKED 0 - #define VAR_UNUSED 1 + #define VAR_UNUSED 0 /* Rely on unused being 0 for calloc call. */ + #define VAR_BLOCKED 1   #define VAR_USED 3      /* FIXME: Shouldn't the following two functions be named "*_or_vars"? */      /* Perform a merge into a.    * Note that b is freed.    */   static void low_and_vars(struct scope_info **a, struct scope_info *b)   {    while (*a && b) {
pike.git/src/las.c:2530:   }      /* Makes a copy of a.    * Note: Can throw errors on out of memory.    */   static struct used_vars *copy_vars(struct used_vars *a)   {    struct used_vars *ret;    struct scope_info *src;    struct scope_info **dst; -  ret=xalloc(sizeof(struct used_vars)); +  ret=ALLOC_STRUCT(used_vars);    src = a->locals;    dst = &(ret->locals);    *dst = NULL;    while (src) {    *dst = malloc(sizeof(struct scope_info));    if (!*dst) {    src = ret->locals;    while(src) {    struct scope_info *tmp = src->next;    free(src);
pike.git/src/las.c:2614: Inside #if defined(PIKE_DEBUG)
   fputs("scope found.\n", stderr);    }   #endif /* PIKE_DEBUG */    return (*a)->vars + num;    }   #ifdef PIKE_DEBUG    if (l_flag > 4) {    fputs("Creating new scope.\n", stderr);    }   #endif /* PIKE_DEBUG */ -  new = (struct scope_info *)xalloc(sizeof(struct scope_info)); -  memset(new, VAR_UNUSED, sizeof(struct scope_info)); +  new = (struct scope_info *)xcalloc(1, sizeof(struct scope_info));    new->next = *a;    new->scope_id = scope_id;    *a = new;    return new->vars + num;   }      /* FIXME: Ought to use parent pointer to avoid recursion. */   /* Find the variables that are used in the tree n. */   /* noblock: Don't mark unused variables that are written to as blocked.    * overwrite: n is an lvalue that is overwritten.