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.
175
2004
/
12
/
21
20:
46
:
09
grubba Exp $
+
|| $Id: builtin.cmod,v 1.
176
2005
/
01
/
07
20:
06
:
45
grubba Exp $
*/ #include "global.h" #include "interpret.h" #include "svalue.h" #include "pike_macros.h" #include "object.h" #include "program.h" #include "array.h" #include "pike_error.h"
pike.git/src/builtin.cmod:1943:
* to be void? * /grubba 2004-09-02 */ if (!from || !to) { Pike_error("Bad number of arguments to create().\n"); } if (from->size != to->size) { Pike_error("Replace must have equal-sized from and to arrays.\n"); }
+
if (!from->size) {
+
/* Enter no-op mode. */
+
THIS->sz = 0;
+
pop_n_elems(args);
+
push_int(0);
+
return;
+
}
+
if( (from->type_field & ~BIT_STRING) && (array_fix_type_field(from) & ~BIT_STRING) ) SIMPLE_BAD_ARG_ERROR("Replace", 1, "array(string)"); if( (to->type_field & ~BIT_STRING) && (array_fix_type_field(to) & ~BIT_STRING) ) SIMPLE_BAD_ARG_ERROR("Replace", 2, "array(string)"); if (THIS->v) { for (i = 0; i < (int)THIS->v_sz; i++) {