Skip to content

Commit 1c29794

Browse files
committed
Remove unused internal function bytes_from_utf8_loc
Commit e4d3d0c removed all the calls to this function.
1 parent ff4c75e commit 1c29794

File tree

5 files changed

+3
-81
lines changed

5 files changed

+3
-81
lines changed

embed.fnc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -791,14 +791,9 @@ Adp |int |bytes_cmp_utf8 |NN const U8 *b \
791791
|STRLEN blen \
792792
|NN const U8 *u \
793793
|STRLEN ulen
794-
AMdp |U8 * |bytes_from_utf8|NN const U8 *s \
794+
Adp |U8 * |bytes_from_utf8|NN const U8 *s \
795795
|NN STRLEN *lenp \
796796
|NN bool *is_utf8p
797-
CTdp |U8 * |bytes_from_utf8_loc \
798-
|NN const U8 *s \
799-
|NN STRLEN *lenp \
800-
|NN bool *is_utf8p \
801-
|NULLOK const U8 **first_unconverted
802797
Adp |U8 * |bytes_to_utf8 |NN const U8 *s \
803798
|NN STRLEN *lenp
804799
AOdp |SSize_t|call_argv |NN const char *sub_name \

embed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
# define block_gimme() Perl_block_gimme(aTHX)
157157
# define block_start(a) Perl_block_start(aTHX_ a)
158158
# define bytes_cmp_utf8(a,b,c,d) Perl_bytes_cmp_utf8(aTHX_ a,b,c,d)
159-
# define bytes_from_utf8_loc Perl_bytes_from_utf8_loc
159+
# define bytes_from_utf8(a,b,c) Perl_bytes_from_utf8(aTHX_ a,b,c)
160160
# define bytes_to_utf8(a,b) Perl_bytes_to_utf8(aTHX_ a,b)
161161
# define call_argv(a,b,c) Perl_call_argv(aTHX_ a,b,c)
162162
# define call_atexit(a,b) Perl_call_atexit(aTHX_ a,b)

proto.h

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

utf8.c

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,71 +2592,15 @@ after-call value of C<*lenp> from it.
25922592
25932593
=cut
25942594
2595-
There is a macro that avoids this function call, but this is retained for
2596-
anyone who calls it with the Perl_ prefix */
2595+
*/
25972596

25982597
U8 *
25992598
Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *lenp, bool *is_utf8p)
26002599
{
26012600
PERL_ARGS_ASSERT_BYTES_FROM_UTF8;
26022601
PERL_UNUSED_CONTEXT;
26032602

2604-
return bytes_from_utf8_loc(s, lenp, is_utf8p, NULL);
2605-
}
2606-
2607-
/*
2608-
=for apidoc bytes_from_utf8_loc
2609-
2610-
Like C<L<perlapi/bytes_from_utf8>()>, but takes an extra parameter, a pointer
2611-
to where to store the location of the first character in C<"s"> that cannot be
2612-
converted to non-UTF8.
2613-
2614-
If that parameter is C<NULL>, this function behaves identically to
2615-
C<bytes_from_utf8>.
2616-
2617-
Otherwise if C<*is_utf8p> is 0 on input, the function behaves identically to
2618-
C<bytes_from_utf8>, except it also sets C<*first_non_downgradable> to C<NULL>.
2619-
2620-
Otherwise, the function returns a newly created C<NUL>-terminated string
2621-
containing the non-UTF8 equivalent of the convertible first portion of
2622-
C<"s">. C<*lenp> is set to its length, not including the terminating C<NUL>.
2623-
If the entire input string was converted, C<*is_utf8p> is set to a FALSE value,
2624-
and C<*first_non_downgradable> is set to C<NULL>.
2625-
2626-
Otherwise, C<*first_non_downgradable> is set to point to the first byte of the
2627-
first character in the original string that wasn't converted. C<*is_utf8p> is
2628-
unchanged. Note that the new string may have length 0.
2629-
2630-
Another way to look at it is, if C<*first_non_downgradable> is non-C<NULL> and
2631-
C<*is_utf8p> is TRUE, this function starts at the beginning of C<"s"> and
2632-
converts as many characters in it as possible stopping at the first one it
2633-
finds that can't be converted to non-UTF-8. C<*first_non_downgradable> is
2634-
set to point to that. The function returns the portion that could be converted
2635-
in a newly created C<NUL>-terminated string, and C<*lenp> is set to its length,
2636-
not including the terminating C<NUL>. If the very first character in the
2637-
original could not be converted, C<*lenp> will be 0, and the new string will
2638-
contain just a single C<NUL>. If the entire input string was converted,
2639-
C<*is_utf8p> is set to FALSE and C<*first_non_downgradable> is set to C<NULL>.
2640-
2641-
Upon successful return, the number of variants in the converted portion of the
2642-
string can be computed by having saved the value of C<*lenp> before the call,
2643-
and subtracting the after-call value of C<*lenp> from it.
2644-
2645-
=cut
2646-
2647-
2648-
*/
2649-
2650-
U8 *
2651-
Perl_bytes_from_utf8_loc(const U8 *s, STRLEN *lenp, bool *is_utf8p, const U8** first_unconverted)
2652-
{
2653-
PERL_ARGS_ASSERT_BYTES_FROM_UTF8_LOC;
2654-
26552603
if (! *is_utf8p) {
2656-
if (first_unconverted) {
2657-
*first_unconverted = NULL;
2658-
}
2659-
26602604
return (U8 *) s;
26612605
}
26622606

@@ -2685,14 +2629,8 @@ Perl_bytes_from_utf8_loc(const U8 *s, STRLEN *lenp, bool *is_utf8p, const U8** f
26852629
/* Then it is multi-byte encoded. If the code point is above 0xFF,
26862630
* have to stop now */
26872631
if (UNLIKELY (! UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s - 1, send))) {
2688-
if (first_unconverted) {
2689-
*first_unconverted = s - 1;
2690-
goto finish_and_return;
2691-
}
2692-
else {
26932632
Safefree(converted_start);
26942633
return (U8 *) s0;
2695-
}
26962634
}
26972635

26982636
c = EIGHT_BIT_UTF8_TO_NATIVE(c, *s);
@@ -2703,11 +2641,7 @@ Perl_bytes_from_utf8_loc(const U8 *s, STRLEN *lenp, bool *is_utf8p, const U8** f
27032641

27042642
/* Here, converted the whole of the input */
27052643
*is_utf8p = FALSE;
2706-
if (first_unconverted) {
2707-
*first_unconverted = NULL;
2708-
}
27092644

2710-
finish_and_return:
27112645
*d = '\0';
27122646
*lenp = d - converted_start;
27132647

utf8.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,8 +1298,6 @@ point's representation.
12981298
#define SHARP_S_SKIP 2
12991299

13001300
#define is_utf8_char_buf(buf, buf_end) isUTF8_CHAR(buf, buf_end)
1301-
#define bytes_from_utf8(s, lenp, is_utf8p) \
1302-
bytes_from_utf8_loc(s, lenp, is_utf8p, 0)
13031301

13041302
/* Do not use; should be deprecated. Use isUTF8_CHAR() instead; this is
13051303
* retained solely for backwards compatibility */

0 commit comments

Comments
 (0)