pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:3119:    /*! @decl int add(string|String.Buffer ... data)    *!    *! Adds @[data] to the buffer.    *!    *! @returns    *! Returns the size of the buffer.    *!    *! @note    *! Pike 7.8 and earlier did not support adding @[String.Buffer]s    *! directly. -  *! -  *! @seealso -  *! @[addat()] +     */    PIKEFUN int add( string|Buffer ... arg1 )    rawtype tFuncV(tNone, tOr(tString, tObjIs_BUFFER), tIntPos);    {    struct Buffer_struct *str = THIS;       if (args) {    int init_from_arg0 = 0, j;    ptrdiff_t sum = 0;    int shift = 0;    for (j=0; j < args; j++) {    struct pike_string *a;    if (TYPEOF(Pike_sp[j-args]) == PIKE_T_STRING)    a = Pike_sp[j-args].u.string;    else if ((TYPEOF(Pike_sp[j-args]) != PIKE_T_OBJECT) ||    (Pike_sp[j-args].u.object->prog != Buffer_program)) -  SIMPLE_BAD_ARG_ERROR("addat", j+1, "string|String.Buffer"); +  SIMPLE_BAD_ARG_ERROR("add", j+1, "string|String.Buffer");    else {    a = OBJ2_BUFFER(Pike_sp[j-args].u.object)->str.s;    if (!a) continue;    }    sum += a->len;    shift |= a->size_shift;    }    shift |= str->str.known_shift;    shift = shift & ~(shift >> 1);    /* We know it will be a string that really is this wide. */