summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2018-01-19 12:45:37 +0000
committerDavid Mitchell <davem@iabyn.com>2018-01-19 13:47:39 +0000
commitf0fd0980104d50d0db555dcafb3ff329e87cc3c7 (patch)
tree6391a7b7e59338256d496ee2b199977ed253f325 /doop.c
parent2b6a74a5a093ee46c821b978c1ca79a6a85722b1 (diff)
downloadperl-f0fd0980104d50d0db555dcafb3ff329e87cc3c7.tar.gz
tr///: return Size_t count rather than I32
Change the signature of all the internal do_trans*() functions to return Size_t rather than I32, so that the count returned by tr//// can cope with strings longer than 2Gb.
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/doop.c b/doop.c
index 22431ef7f0..38b0286419 100644
--- a/doop.c
+++ b/doop.c
@@ -35,10 +35,10 @@
* or may not be utf8.
*/
-STATIC I32
+STATIC Size_t
S_do_trans_simple(pTHX_ SV * const sv)
{
- I32 matches = 0;
+ Size_t matches = 0;
STRLEN len;
U8 *s = (U8*)SvPV_nomg(sv,len);
U8 * const send = s+len;
@@ -114,13 +114,13 @@ S_do_trans_simple(pTHX_ SV * const sv)
* or may not be utf8.
*/
-STATIC I32
+STATIC Size_t
S_do_trans_count(pTHX_ SV * const sv)
{
STRLEN len;
const U8 *s = (const U8*)SvPV_nomg_const(sv, len);
const U8 * const send = s + len;
- I32 matches = 0;
+ Size_t matches = 0;
const OPtrans_map * const tbl = (OPtrans_map*)cPVOP->op_pv;
PERL_ARGS_ASSERT_DO_TRANS_COUNT;
@@ -159,13 +159,13 @@ S_do_trans_count(pTHX_ SV * const sv)
* or may not be utf8.
*/
-STATIC I32
+STATIC Size_t
S_do_trans_complex(pTHX_ SV * const sv)
{
STRLEN len;
U8 *s = (U8*)SvPV_nomg(sv, len);
U8 * const send = s+len;
- I32 matches = 0;
+ Size_t matches = 0;
const OPtrans_map * const tbl = (OPtrans_map*)cPVOP->op_pv;
PERL_ARGS_ASSERT_DO_TRANS_COMPLEX;
@@ -283,7 +283,7 @@ S_do_trans_complex(pTHX_ SV * const sv)
* or may not be utf8.
*/
-STATIC I32
+STATIC Size_t
S_do_trans_simple_utf8(pTHX_ SV * const sv)
{
U8 *s;
@@ -291,7 +291,7 @@ S_do_trans_simple_utf8(pTHX_ SV * const sv)
U8 *d;
U8 *start;
U8 *dstart, *dend;
- I32 matches = 0;
+ Size_t matches = 0;
const I32 grows = PL_op->op_private & OPpTRANS_GROWS;
STRLEN len;
SV* const rv =
@@ -392,13 +392,13 @@ S_do_trans_simple_utf8(pTHX_ SV * const sv)
* or may not be utf8.
*/
-STATIC I32
+STATIC Size_t
S_do_trans_count_utf8(pTHX_ SV * const sv)
{
const U8 *s;
const U8 *start = NULL;
const U8 *send;
- I32 matches = 0;
+ Size_t matches = 0;
STRLEN len;
SV* const rv =
#ifdef USE_ITHREADS
@@ -443,12 +443,12 @@ S_do_trans_count_utf8(pTHX_ SV * const sv)
* or may not be utf8.
*/
-STATIC I32
+STATIC Size_t
S_do_trans_complex_utf8(pTHX_ SV * const sv)
{
U8 *start, *send;
U8 *d;
- I32 matches = 0;
+ Size_t matches = 0;
const I32 squash = PL_op->op_private & OPpTRANS_SQUASH;
const I32 del = PL_op->op_private & OPpTRANS_DELETE;
const I32 grows = PL_op->op_private & OPpTRANS_GROWS;
@@ -611,7 +611,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const sv)
* Returns a count of number of characters translated
*/
-I32
+Size_t
Perl_do_trans(pTHX_ SV *sv)
{
STRLEN len;