From f46a3253ca26d92e35b9a4ce704f7541049caeaa Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 10 Sep 2013 21:28:31 -0600 Subject: [PATCH] perlapi: Add doc for my_strlcpy, my_strlcat --- embed.fnc | 4 ++-- util.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/embed.fnc b/embed.fnc index 6ad48d3..aff36ef 100644 --- a/embed.fnc +++ b/embed.fnc @@ -2549,11 +2549,11 @@ Xpo |void |xs_apiversion_bootcheck|NN SV *module|NN const char *api_p \ |STRLEN api_len #ifndef HAS_STRLCAT -Apno |Size_t |my_strlcat |NULLOK char *dst|NULLOK const char *src|Size_t size +Apnod |Size_t |my_strlcat |NULLOK char *dst|NULLOK const char *src|Size_t size #endif #ifndef HAS_STRLCPY -Apno |Size_t |my_strlcpy |NULLOK char *dst|NULLOK const char *src|Size_t size +Apnod |Size_t |my_strlcpy |NULLOK char *dst|NULLOK const char *src|Size_t size #endif #ifdef PERL_MAD diff --git a/util.c b/util.c index d2380b2..55f6d9e 100644 --- a/util.c +++ b/util.c @@ -6033,6 +6033,26 @@ Perl_xs_apiversion_bootcheck(pTHX_ SV *module, const char *api_p, Perl_croak_sv(aTHX_ xpt); } +/* +=for apidoc my_strlcat + +The C library C if available, or a Perl implementation of it. +This operates on C NUL-terminated strings. + +C appends string C to the end of C. It will append at +most S> characters. It will then NUL-terminate, +unless C is 0 or the original C string was longer than C (in +practice this should not happen as it means that either C is incorrect or +that C is not a proper NUL-terminated string). + +Note that C is the full size of the destination buffer and +the result is guaranteed to be NUL-terminated if there is room. Note that room +for the NUL should be included in C. + +=cut + +Description stolen from http://www.openbsd.org/cgi-bin/man.cgi?query=strlcat +*/ #ifndef HAS_STRLCAT Size_t Perl_my_strlcat(char *dst, const char *src, Size_t size) @@ -6050,6 +6070,20 @@ Perl_my_strlcat(char *dst, const char *src, Size_t size) } #endif + +/* +=for apidoc my_strlcpy + +The C library C if available, or a Perl implementation of it. +This operates on C NUL-terminated strings. + +C copies up to S> characters from the string C +to C, NUL-terminating the result if C is not 0. + +=cut + +Description stolen from http://www.openbsd.org/cgi-bin/man.cgi?query=strlcpy +*/ #ifndef HAS_STRLCPY Size_t Perl_my_strlcpy(char *dst, const char *src, Size_t size) -- 2.7.4