pike.git/
src/
operators.c
Branch:
Tag:
Non-build tags
All tags
No tags
2023-02-03
2023-02-03 10:51:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>
fb244a8cfe1c7b155e93a55ffe640f3003097630 (
49
lines) (+
14
/-
35
)
[
Show
|
Annotate
]
Branch:
master
Runtime: Use index_error() in more places.
79:
if(i<0 || i>=len) { if(len == 0)
-
Pike
_error("Attempt to index the empty string with %"PRINTPIKEINT"d.\n", i);
+
index
_error(
NULL, 0, what, ind,
+
"Attempt to index the empty string with %"PRINTPIKEINT"d.\n", i);
else
-
Pike
_error("Index %"PRINTPIKEINT"d is out of string range "
+
index
_error(
NULL, 0, what, ind,
+
"Index %"PRINTPIKEINT"d is out of string range "
"%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n", i, -len, len - 1); } else
89:
SET_SVAL(*to, T_INT, NUMBER_NUMBER, integer, i); break; }else{
-
if (TYPEOF(*ind) == T
_
STRING)
-
Pike_
error
(
"Expected
integer as string index
,
got \"%S\".\n"
,
-
ind
->u.string);
-
else
-
Pike_error ("Expected integer as string index
,
got %s.\n",
-
get_name_of_type (TYPEOF(*ind
)
))
;
+
index
_error(
NULL,
0
,
what
, ind,
NULL
);
} case T_FUNCTION:
110:
index_no_free(to, what, ind); if(IS_UNDEFINED(to)) { if (val) {
-
Pike
_error("Indexing the integer %"PRINTPIKEINT"d "
+
index
_error(
NULL, 0, what, ind,
+
"Indexing the integer %"PRINTPIKEINT"d "
"with unknown method \"%S\".\n", val, ind->u.string); } else {
-
Pike
_error(
"Indexing the
NULL
value
with \"%S\".\n"
,
-
ind
->u.string
);
+
index
_error(NULL
,
0,
what,
ind
,
NULL
);
} } break;
125:
default: index_error:
-
if (TYPEOF(*ind) == T_INT)
-
Pike_error ("Cannot
index
%s with %"PRINTPIKEINT"d.\n",
-
(TYPEOF(*what) == T
_
INT && !what->u.integer)?
-
"the NULL value":get_name_of_type(TYPEOF(*what)),
-
ind->u.integer);
-
else if (TYPEOF(*ind) == T_FLOAT)
-
Pike_
error
(
"Cannot index %s with %"PRINTPIKEFLOAT"e.\n",
-
(TYPEOF(*what) == T_INT && !what->u.integer)?
-
"the
NULL
value":get_name_of_type(TYPEOF(*what))
,
-
ind->u.float_number);
-
else if (TYPEOF(*ind) == T_STRING)
-
Pike_error ("Cannot index %s with \"%S\".\n"
,
-
(TYPEOF(*
what
) == T_INT && !what->u.integer)?
-
"the NULL value":get_name_of_type(TYPEOF(*what))
,
-
ind
->u.string);
-
else
-
Pike_error ("Cannot index %s with %s.\n"
,
-
(TYPEOF(*what) == T_INT && !what->u.integer)?
-
"the
NULL
value":get_name_of_type(TYPEOF(*what
)
),
-
get_name_of_type (TYPEOF(*ind)))
;
+
index_error(NULL,
0
, what, ind, NULL);
} }