pike.git/
src/
builtin_functions.c
Branch:
Tag:
Non-build tags
All tags
No tags
2001-06-27
2001-06-27 17:42:12 by Henrik Grubbström (Grubba) <grubba@grubba.org>
e614a34b21257a9bc96de5bacea865a6d11da77d (
21
lines) (+
15
/-
6
)
[
Show
|
Annotate
]
Branch:
7.0
Backported replace_many() fix from Pike 7.3.
Rev: src/builtin_functions.c:1.263
5:
\*/ /**/ #include "global.h"
-
RCSID("$Id: builtin_functions.c,v 1.
262
2001/06/
09
15
:
25
:
36
grubba Exp $");
+
RCSID("$Id: builtin_functions.c,v 1.
263
2001/06/
27
17
:
42
:
12
grubba Exp $");
#include "interpret.h" #include "svalue.h" #include "pike_macros.h"
2143:
}
-
static struct pike_string *
replace_many(struct pike_string *str,
+
static struct pike_string *replace_many(struct pike_string *str,
struct array *from, struct array *to) {
2198:
{ INT32 x; x=index_shared_string(v[num-1-e].ind,0);
-
if(x<(INT32)NELEM(set_start)) set_start[x]=num-e-1;
+
if(
(
x
>= 0) && (x
<(INT32)NELEM(set_start))
)
+
set_start[x]=num-e-1;
x=index_shared_string(v[e].ind,0);
-
if(x<(INT32)NELEM(set_end)) set_end[x]=e+1;
+
if(
(
x
>= 0) && (x
<(INT32)NELEM(set_end))
)
+
set_end[x]=e+1;
} init_string_builder(&ret,str->size_shift);
2212:
INT32 a,b,ch; ch=index_shared_string(str,s);
-
if(ch<(INT32)NELEM(set_end)) b=set_end[ch]; else b=num;
+
if(
(
ch
>= 0) && (ch
<(INT32)NELEM(set_end))
)
+
b=set_end[ch];
+
else
+
b=num;
if(b) {
-
if(ch<(INT32)NELEM(set_start)) a=set_start[ch]; else a=0;
+
if(
(
ch
>= 0) && (ch
<(INT32)NELEM(set_start))
)
+
a=set_start[ch];
+
else
+
a=0;
a=find_longest_prefix(str->str+(s << str->size_shift), length,