summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2022-12-24 02:09:40 +0100
committerAlejandro Colomar <alx@kernel.org>2022-12-24 02:21:13 +0100
commit7f69d86045c894c71ca75d0abe9a9a8ee5fb5e08 (patch)
tree5c980449782c76d5d16e68128468182dfe3504f6
parentceca55dbf7fc61cdbeef930e5c1e1d5a28d04e21 (diff)
stpecpy.h, stpecpy.3, stpecpyx.3, stpecpy.c: Remove stpecpyx()
It was equivalent to stpecpy(). Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--include/stp/stpe/stpecpy.h2
-rw-r--r--share/man/man3/stpecpy.331
-rw-r--r--share/man/man3/stpecpyx.31
-rw-r--r--src/stp/stpe/stpecpy.c11
4 files changed, 9 insertions, 36 deletions
diff --git a/include/stp/stpe/stpecpy.h b/include/stp/stpe/stpecpy.h
index f16da4f..7dc318a 100644
--- a/include/stp/stpe/stpecpy.h
+++ b/include/stp/stpe/stpecpy.h
@@ -12,8 +12,6 @@
#pragma clang assume_nonnull begin
char *stp_nullable stpecpy(char *stp_nullable dst, char *end,
const char *restrict src);
-char *stp_nullable stpecpyx(char *stp_nullable dst, char *end,
- const char *restrict src);
#pragma clang assume_nonnull end
diff --git a/share/man/man3/stpecpy.3 b/share/man/man3/stpecpy.3
index 2ff5440..6d58aa1 100644
--- a/share/man/man3/stpecpy.3
+++ b/share/man/man3/stpecpy.3
@@ -4,7 +4,7 @@
.\"
.TH stpecpy 3 (date) "libstp (unreleased)"
.SH NAME
-stpecpy, stpecpyx \- copy a string with truncation
+stpecpy \- copy a string with truncation
.SH LIBRARY
stp string library
.RI ( libstp ", " "pkgconf --cflags --libs libstp" )
@@ -14,11 +14,9 @@ stp string library
.PP
.BI "char *_Nullable stpecpy(char *_Nullable " dst ", char " end [0],
.BI " const char *restrict " src );
-.BI "char *_Nullable stpecpyx(char *_Nullable " dst ", char " end [0],
-.BI " const char *restrict " src );
.fi
.SH DESCRIPTION
-These functions copy the string pointed to by
+This function copies the string pointed to by
.IR src ,
into a string at the buffer pointed to by
.IR dst .
@@ -29,16 +27,12 @@ limited by a pointer to its
isn't large enough to hold the copy,
the resulting string is truncated.
.PP
-.MR stpecpyx 3
-forces a SIGSEGV if the input is not a string,
-by traversing it entirely.
-.PP
-These functions can be chained with calls to
+This function can be chained with calls to
.MR stpeprintf 3
and
.MR vstpeprintf 3 .
.PP
-An implementation of these functions might be
+An implementation of this function might be
.PP
.in +4n
.EX
@@ -49,6 +43,9 @@ char *
{
char *p;
+ if (src[strlen(src)] != \(aq\e0\(aq)
+ raise(SIGSEGV);
+
if (dst == end || dst == NULL)
return dst;
@@ -60,15 +57,6 @@ char *
end[\-1] = \(aq\e0\(aq;
return end;
}
-
-char *
-.IR stpecpyx "(char *dst, char end[0], const char *restrict src)"
-{
- if (src[strlen(src)] != \(aq\e0\(aq)
- raise(SIGSEGV);
-
- return stpecpy(dst, end, src);
-}
.EE
.in
.SH RETURN VALUE
@@ -88,13 +76,13 @@ If
.I dst
was equal to
.I end
-(a previous call to these functions truncated).
+(a previous call to this function truncated).
.PD
.RE
.TP
.I dst + strlen(dst)
On success,
-these functions return a pointer to the terminating null byte.
+this function returpn a pointer to the terminating null byte.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
@@ -107,7 +95,6 @@ l l l.
Interface Attribute Value
T{
.MR stpecpy 3 ,
-.MR stpecpyx 3
T} Thread safety MT-Safe
.TE
.hy
diff --git a/share/man/man3/stpecpyx.3 b/share/man/man3/stpecpyx.3
deleted file mode 100644
index b0e77ae..0000000
--- a/share/man/man3/stpecpyx.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/stpecpy.3
diff --git a/src/stp/stpe/stpecpy.c b/src/stp/stpe/stpecpy.c
index a2d1cf2..0fbc014 100644
--- a/src/stp/stpe/stpecpy.c
+++ b/src/stp/stpe/stpecpy.c
@@ -4,7 +4,6 @@
#include <stp/stpe/stpecpy.h>
-#include <signal.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
@@ -34,14 +33,4 @@ stpecpy(char *stp_nullable dst, char end[0], const char *restrict src)
return mempcpy(dst, src, dlen) + trunc;
}
-
-
-char *stp_nullable
-stpecpyx(char *stp_nullable dst, char end[0], const char *restrict src)
-{
- if (stp_unlikely(src[strlen(src)] != '\0'))
- (void) raise(SIGSEGV);
-
- return stpecpy(dst, end, src);
-}
#pragma clang assume_nonnull end