pike.git/
src/
builtin_functions.c
Branch:
Tag:
Non-build tags
All tags
No tags
2001-06-27
2001-06-27 17:33:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>
70da5ac6bd376b570e2ef7ca1e4ed5f55dce3339 (
31
lines) (+
20
/-
11
)
[
Show
|
Annotate
]
Branch:
7.9
Fixed bug in replace_many().
Rev: src/builtin_functions.c:1.383
5:
\*/ /**/ #include "global.h"
-
RCSID("$Id: builtin_functions.c,v 1.
382
2001/06/
25
20
:
03
:
39
grubba Exp $");
+
RCSID("$Id: builtin_functions.c,v 1.
383
2001/06/
27
17
:
33
:
42
grubba Exp $");
#include "interpret.h" #include "svalue.h" #include "pike_macros.h"
2794:
struct pike_string *val; };
-
static int replace_sortfun(struct tupel *a,struct tupel *b)
-
{
-
return DO_NOT_WARN((int)my_quick_strcmp(a->ind, b->ind));
-
}
-
+
/* Magic, magic and more magic */ static int find_longest_prefix(char *str, ptrdiff_t len,
2867:
}
-
static struct pike_string *
replace_many(struct pike_string *str,
+
static
int replace_sortfun(
struct
tupel *a,struct tupel *b)
+
{
+
return DO_NOT_WARN((int)my_quick_strcmp(a->ind, b->ind));
+
}
+
+
static struct
pike_string *replace_many(struct pike_string *str,
struct array *from, struct array *to) {
2923:
{ 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);
2938:
ptrdiff_t ch; ch=index_shared_string(str,s);
-
if(ch<(ptrdiff_t)NELEM(set_end)) b=set_end[ch]; else b=num;
+
if(
(
ch
>= 0) && (ch
<(ptrdiff_t)NELEM(set_end))
)
+
b=set_end[ch];
+
else
+
b=num;
if(b) {
-
if(ch<(ptrdiff_t)NELEM(set_start)) a=set_start[ch]; else a=0;
+
if(
(
ch
>= 0) && (ch
<(ptrdiff_t)NELEM(set_start))
)
+
a=set_start[ch];
+
else
+
a=0;
a=find_longest_prefix(str->str+(s << str->size_shift), length,