pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:4368:    *! Get the element at the tail of the list.    *!    *! @throws    *! Throws an error if the list is empty.    *!    *! @seealso    *! @[is_empty()], @[head()], @[pop()]    */    PIKEFUN mixed tail()    { -  if (THIS->tail->prev) { -  push_svalue(&THIS->tail->val); +  struct pike_list_node * node = TAIL_SENTINEL(THIS); +  if (THIS->head->next) { +  push_svalue(&node->prev->val);    } else {    Pike_error("Empty list.\n");    }    }       /*! @decl mixed pop()    *!    *! Pop the element at the head of the list from the list.    *!    *! @throws
pike.git/src/builtin.cmod:4475:    /* NOTE: cur may never refer to an unlinked node.    * cur may however refer to a detached node, or to sentinels.    */       static struct List_struct *List__get_iterator_find_parent()    {    struct external_variable_context loc;       loc.o = Pike_fp->current_object;    loc.parent_identifier = Pike_fp->fun; +  if (loc.parent_identifier == FUNCTION_BUILTIN) { +  loc.inherit = loc.o->prog->inherits +  + loc.o->prog->num_inherits - 1; +  } else {    loc.inherit = INHERIT_FROM_INT(loc.o->prog, loc.parent_identifier); -  +  }    find_external_context(&loc, 1);    return (struct List_struct *)(loc.o->storage +    loc.inherit->storage_offset);    }       INIT    {    add_ref(THIS->cur = List__get_iterator_find_parent()->head);    THIS->ind = 0;    }