pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:1:
/* -*- c -*- || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: builtin.cmod,v 1.
97
2002/11/
26
14
:
50
:44 grubba Exp $
+
|| $Id: builtin.cmod,v 1.
98
2002/11/
27
09
:
41
:44 grubba Exp $
*/ #include "global.h" #include "interpret.h" #include "svalue.h" #include "opcodes.h" #include "pike_macros.h" #include "object.h" #include "program.h" #include "array.h"
pike.git/src/builtin.cmod:1468:
/*! @decl int add(string ... data) *! *! Adds @[data] to the buffer. Returns the size of the buffer. *! */ PIKEFUN int add( string ... arg1 ) { struct Buffer_struct *str = THIS; int j;
+
for (j=0; j < args; j++) {
+
if (Pike_sp[j-args].type != T_STRING) {
+
Pike_error("add(): Bad argument %d (expected string).", j+1);
+
}
+
}
+
if (!str->str.s && args) { int sum = 0; int shift = 0; for (j=0; j < args; j++) { struct pike_string *a = Pike_sp[j-args].u.string; sum += a->len; shift |= a->size_shift; } if (sum < str->initial) { sum = str->initial;