summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-12-22 12:50:46 +0100
committerYves Orton <demerphq@gmail.com>2022-12-22 13:40:09 +0100
commit81620fbedd5f5cb87f240d7809dc669cd60d0139 (patch)
tree601d3a5035a12043e381879ec0ea0541482bf6c0
parent4d564167cb2239671a1cf3a594f6429834f3da55 (diff)
downloadperl-81620fbedd5f5cb87f240d7809dc669cd60d0139.tar.gz
Revert "Inline strlcat(), strlcpy()"
This reverts commit 5be23dd97e360d19c8abb4c0c534f5d5f9d3691a. The original patch seems to break DBM.
-rw-r--r--embed.fnc4
-rw-r--r--inline.h74
-rw-r--r--proto.h4
-rw-r--r--util.c74
4 files changed, 78 insertions, 78 deletions
diff --git a/embed.fnc b/embed.fnc
index fe66907b97..d4c6b5850b 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -3780,11 +3780,11 @@ FXpoT |I32 |xs_handshake |const U32 key|NN void * v_my_perl\
|NN const char * file| ...
Xp |void |xs_boot_epilog |const I32 ax
#ifndef HAS_STRLCAT
-AsTd |Size_t |my_strlcat |NULLOK char *dst|NULLOK const char *src|Size_t size
+ApTd |Size_t |my_strlcat |NULLOK char *dst|NULLOK const char *src|Size_t size
#endif
#ifndef HAS_STRLCPY
-AsTd |Size_t |my_strlcpy |NULLOK char *dst|NULLOK const char *src|Size_t size
+ApTd |Size_t |my_strlcpy |NULLOK char *dst|NULLOK const char *src|Size_t size
#endif
#ifndef HAS_STRNLEN
diff --git a/inline.h b/inline.h
index 484bc39326..49cae2738b 100644
--- a/inline.h
+++ b/inline.h
@@ -3625,79 +3625,5 @@ Perl_savesharedsvpv(pTHX_ SV *sv)
}
/*
-=for apidoc my_strlcat
-
-The C library C<strlcat> if available, or a Perl implementation of it.
-This operates on C C<NUL>-terminated strings.
-
-C<my_strlcat()> appends string C<src> to the end of C<dst>. It will append at
-most S<C<size - strlen(dst) - 1>> characters. It will then C<NUL>-terminate,
-unless C<size> is 0 or the original C<dst> string was longer than C<size> (in
-practice this should not happen as it means that either C<size> is incorrect or
-that C<dst> is not a proper C<NUL>-terminated string).
-
-Note that C<size> is the full size of the destination buffer and
-the result is guaranteed to be C<NUL>-terminated if there is room. Note that
-room for the C<NUL> should be included in C<size>.
-
-The return value is the total length that C<dst> would have if C<size> is
-sufficiently large. Thus it is the initial length of C<dst> plus the length of
-C<src>. If C<size> is smaller than the return, the excess was not appended.
-
-=cut
-
-Description stolen from http://man.openbsd.org/strlcat.3
-*/
-#ifndef HAS_STRLCAT
-PERL_STATIC_INLINE Size_t
-Perl_my_strlcat(char *dst, const char *src, Size_t size)
-{
- Size_t used, length, copy;
-
- used = strlen(dst);
- length = strlen(src);
- if (size > 0 && used < size - 1) {
- copy = (length >= size - used) ? size - used - 1 : length;
- memcpy(dst + used, src, copy);
- dst[used + copy] = '\0';
- }
- return used + length;
-}
-#endif
-
-
-/*
-=for apidoc my_strlcpy
-
-The C library C<strlcpy> if available, or a Perl implementation of it.
-This operates on C C<NUL>-terminated strings.
-
-C<my_strlcpy()> copies up to S<C<size - 1>> characters from the string C<src>
-to C<dst>, C<NUL>-terminating the result if C<size> is not 0.
-
-The return value is the total length C<src> would be if the copy completely
-succeeded. If it is larger than C<size>, the excess was not copied.
-
-=cut
-
-Description stolen from http://man.openbsd.org/strlcpy.3
-*/
-#ifndef HAS_STRLCPY
-PERL_STATIC_INLINE Size_t
-Perl_my_strlcpy(char *dst, const char *src, Size_t size)
-{
- Size_t length, copy;
-
- length = strlen(src);
- if (size > 0) {
- copy = (length >= size) ? size - 1 : length;
- memcpy(dst, src, copy);
- dst[copy] = '\0';
- }
- return length;
-}
-#endif
-
-/*
* ex: set ts=8 sts=4 sw=4 et:
*/
diff --git a/proto.h b/proto.h
index 3cb29fa60a..a0c5f497f6 100644
--- a/proto.h
+++ b/proto.h
@@ -4860,11 +4860,11 @@ PERL_CALLCONV int Perl_signbit(NV f)
#endif
#if !defined(HAS_STRLCAT)
-STATIC Size_t Perl_my_strlcat(char *dst, const char *src, Size_t size);
+PERL_CALLCONV Size_t Perl_my_strlcat(char *dst, const char *src, Size_t size);
#define PERL_ARGS_ASSERT_MY_STRLCAT
#endif
#if !defined(HAS_STRLCPY)
-STATIC Size_t Perl_my_strlcpy(char *dst, const char *src, Size_t size);
+PERL_CALLCONV Size_t Perl_my_strlcpy(char *dst, const char *src, Size_t size);
#define PERL_ARGS_ASSERT_MY_STRLCPY
#endif
#if !defined(HAS_STRNLEN)
diff --git a/util.c b/util.c
index 16c87e280e..8da7c11fa7 100644
--- a/util.c
+++ b/util.c
@@ -5738,6 +5738,80 @@ S_xs_version_bootcheck(pTHX_ U32 items, U32 ax, const char *xs_p,
}
}
+/*
+=for apidoc my_strlcat
+
+The C library C<strlcat> if available, or a Perl implementation of it.
+This operates on C C<NUL>-terminated strings.
+
+C<my_strlcat()> appends string C<src> to the end of C<dst>. It will append at
+most S<C<size - strlen(dst) - 1>> characters. It will then C<NUL>-terminate,
+unless C<size> is 0 or the original C<dst> string was longer than C<size> (in
+practice this should not happen as it means that either C<size> is incorrect or
+that C<dst> is not a proper C<NUL>-terminated string).
+
+Note that C<size> is the full size of the destination buffer and
+the result is guaranteed to be C<NUL>-terminated if there is room. Note that
+room for the C<NUL> should be included in C<size>.
+
+The return value is the total length that C<dst> would have if C<size> is
+sufficiently large. Thus it is the initial length of C<dst> plus the length of
+C<src>. If C<size> is smaller than the return, the excess was not appended.
+
+=cut
+
+Description stolen from http://man.openbsd.org/strlcat.3
+*/
+#ifndef HAS_STRLCAT
+Size_t
+Perl_my_strlcat(char *dst, const char *src, Size_t size)
+{
+ Size_t used, length, copy;
+
+ used = strlen(dst);
+ length = strlen(src);
+ if (size > 0 && used < size - 1) {
+ copy = (length >= size - used) ? size - used - 1 : length;
+ memcpy(dst + used, src, copy);
+ dst[used + copy] = '\0';
+ }
+ return used + length;
+}
+#endif
+
+
+/*
+=for apidoc my_strlcpy
+
+The C library C<strlcpy> if available, or a Perl implementation of it.
+This operates on C C<NUL>-terminated strings.
+
+C<my_strlcpy()> copies up to S<C<size - 1>> characters from the string C<src>
+to C<dst>, C<NUL>-terminating the result if C<size> is not 0.
+
+The return value is the total length C<src> would be if the copy completely
+succeeded. If it is larger than C<size>, the excess was not copied.
+
+=cut
+
+Description stolen from http://man.openbsd.org/strlcpy.3
+*/
+#ifndef HAS_STRLCPY
+Size_t
+Perl_my_strlcpy(char *dst, const char *src, Size_t size)
+{
+ Size_t length, copy;
+
+ length = strlen(src);
+ if (size > 0) {
+ copy = (length >= size) ? size - 1 : length;
+ memcpy(dst, src, copy);
+ dst[copy] = '\0';
+ }
+ return length;
+}
+#endif
+
PERL_STATIC_INLINE bool
S_gv_has_usable_name(pTHX_ GV *gv)
{