pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:3081:       pop_stack();    push_undefined();    }       /*! @decl int|Buffer `[](int index, int|void end_or_none)    */    PIKEFUN int|Buffer `[](int index, int|void end_or_none)    {    struct Buffer_struct *str = THIS; -  struct pike_string *s; -  unsigned len = 0,shift; -  void *p; +  struct pike_string *s = str->str.s; +  unsigned len = 0,shift = 0; +  void *p = NULL;    -  if (s = str->str.s) +  if (s)    len = s->len, shift = s->size_shift, p = s->str;       if (args==1) {    pop_n_elems(args);    if (index<0)    index += len;    if (index<0 || index>=len)    index_error("Buffer->`[]", Pike_sp, args, NULL, Pike_sp,    "Index %"PRINTPIKEINT"d is out of array range 0..%d,\n",    index, len-1);
pike.git/src/builtin.cmod:3128:    res->flags |= OBJECT_CLEAR_ON_EXIT;    push_object (res);    }    }       /*! @decl int `[]=(int index, int ch)    */    PIKEFUN int `[]=(int index, int ch)    {    struct Buffer_struct *str = THIS; -  struct pike_string *s; -  unsigned len = 0,shift; -  void *p; +  struct pike_string *s = str->str.s; +  unsigned len = 0,shift = 0; +  void *p = NULL;       pop_n_elems(args); -  if (s = str->str.s) +  if (s)    len = s->len, shift = s->size_shift, p = s->str;       if (index<0)    index += len;    if (index<0 || index>=len)    index_error("Buffer->`[]=", Pike_sp, args, NULL, Pike_sp,    "Index %"PRINTPIKEINT"d is out of array range 0..%d,\n",    index, len-1);    p = (char*)p+(index<<shift);    if (!shift)
pike.git/src/builtin.cmod:3381:    *! Cut and delete the range of data from the current buffer.    *! Returns a new buffer with the cut data, unless discard is true.    *!    *! @seealso    *! @[get()], @[get_copy()], @[clear()]    */    PIKEFUN Buffer|void cut(int index, int|void end_or_none,void|int discard)    {    struct Buffer_struct *str = THIS, *str2;    struct object *res; -  struct pike_string *s; -  unsigned len = 0,shift; -  void *p; +  struct pike_string *s = str->str.s; +  unsigned len = 0,shift = 0; +  void *p = NULL;    INT_TYPE end,vdiscard;    -  if (s = str->str.s) +  if (s)    len = s->len, shift = s->size_shift, p = s->str;       end = args==1 ? len-1 : end_or_none->u.integer;    vdiscard = args==3 ? discard->u.integer : 0;    pop_n_elems(args);       if (index < 0)    index = 0;    if (end >= len)    end = len-1;