2003-05-15
2003-05-15 15:33:31 by Martin Stjernholm <mast@lysator.liu.se>
-
b99d88b3650cedf46c8572aeaf5a27bd8d613dce
(29 lines)
(+19/-10)
[
Show
| Annotate
]
Branch: 7.9
Improved some range check error messages.
Rev: src/array.c:1.147
Rev: src/builtin.cmod:1.136
Rev: src/builtin_functions.c:1.493
Rev: src/error.c:1.108
Rev: src/fd_control.c:1.48
Rev: src/opcodes.c:1.147
Rev: src/operators.c:1.179
Rev: src/stralloc.c:1.156
2:
|| 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: stralloc.c,v 1.155 2003/04/07 15:28:47 mast Exp $
+ || $Id: stralloc.c,v 1.156 2003/05/15 15:33:31 mast Exp $
*/
#include "global.h"
24:
#include <ctype.h>
#include <math.h>
- RCSID("$Id: stralloc.c,v 1.155 2003/04/07 15:28:47 mast Exp $");
+ RCSID("$Id: stralloc.c,v 1.156 2003/05/15 15:33:31 mast Exp $");
/* #define STRALLOC_USE_PRIMES */
167: Inside #if defined(PIKE_DEBUG)
#ifdef PIKE_DEBUG
if(pos > s->len || pos<0) {
if (s->len) {
- Pike_fatal("String index %ld is out of range [0 - %ld]!\n",
- DO_NOT_WARN((long)pos),
- DO_NOT_WARN((long)s->len-1));
+ Pike_fatal("String index %"PRINTPTRDIFFT"d is out of "
+ "range 0..%"PRINTPTRDIFFT"d.\n",
+ pos, s->len-1);
} else {
- Pike_fatal("Attempt to index the empty string with %ld!\n",
- DO_NOT_WARN((long)pos));
+ Pike_fatal("Attempt to index the empty string with %"PRINTPTRDIFFT"d.\n",
+ pos);
}
}
#endif
183:
int value)
{
#ifdef PIKE_DEBUG
- if(pos > s->len || pos<0)
- Pike_fatal("string index out of range!\n");
+ if(pos > s->len || pos<0) {
+ if (s->len) {
+ Pike_fatal("String index %"PRINTPTRDIFFT"d is out of "
+ "range 0..%"PRINTPTRDIFFT"d.\n",
+ pos, s->len-1);
+ } else {
+ Pike_fatal("Attempt to index the empty string with %"PRINTPTRDIFFT"d.\n",
+ pos);
+ }
+ }
if(pos == s->len && value)
Pike_fatal("string zero termination foul!\n");