pike.git/
src/
stralloc.c
Branch:
Tag:
Non-build tags
All tags
No tags
1998-10-15
1998-10-15 02:34:37 by Henrik Grubbström (Grubba) <grubba@grubba.org>
49ed18955d7422e37ea8fca951ab50a877bdef46 (
12
lines) (+
9
/-
3
)
[
Show
|
Annotate
]
Branch:
7.9
Improved indexing error message.
Rev: src/stralloc.c:1.45
15:
#include <ctype.h>
-
RCSID("$Id: stralloc.c,v 1.
44
1998/10/
14
22
:
18
:
18
hubbe
Exp $");
+
RCSID("$Id: stralloc.c,v 1.
45
1998/10/
15
02
:
34
:
37
grubba
Exp $");
#define BEGIN_HASH_SIZE 997 #define MAX_AVG_LINK_LENGTH 3
91:
INLINE unsigned INT32 index_shared_string(struct pike_string *s, int pos) { #ifdef DEBUG
-
if(pos > s->len || pos<0)
-
fatal("
string
index out of range!\n");
+
if(pos >
=
s->len || pos<0)
{
+
if (s->len) {
+
fatal("
String
index
%d is
out of range
[0 - %d]
!\n"
, pos, s->len-1
);
+
} else {
+
fatal("Attempt to index the empty string with %d!\n", pos);
+
}
+
}
#endif return generic_extract(s->str,s->size_shift,pos); }