From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "Mowka, Mateusz" <mateusz.mowka@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "rebecca@nuviainc.com" <rebecca@nuviainc.com>
Subject: Re: [PATCH v1] From: Mateusz Mówka <mateusz.mowka@intel.com> Subject: [edk2-libc] Add strnlen function wrapper
Date: Wed, 10 Aug 2022 21:26:31 +0000 [thread overview]
Message-ID: <CO1PR11MB492906C04986B4EEFDFEDED5D2659@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220810092414.467-1-mateusz.mowka@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> -----Original Message-----
> From: Mowka, Mateusz <mateusz.mowka@intel.com>
> Sent: Wednesday, August 10, 2022 2:24 AM
> To: devel@edk2.groups.io
> Cc: rebecca@nuviainc.com; Kinney, Michael D <michael.d.kinney@intel.com>; Mowka, Mateusz <mateusz.mowka@intel.com>
> Subject: [PATCH v1] From: Mateusz Mówka <mateusz.mowka@intel.com> Subject: [edk2-libc] Add strnlen function wrapper
>
> This patch adds strnlen function wrapper that internally
> calls AsciiStrnLenS defined in BaseLib.
>
> Signed-off-by: Mateusz Mówka <mateusz.mowka@intel.com>
> ---
> StdLib/Include/string.h | 11 +++++++++++
> StdLib/LibC/String/Misc.c | 14 ++++++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/StdLib/Include/string.h b/StdLib/Include/string.h
> index 0c80944..73193aa 100644
> --- a/StdLib/Include/string.h
> +++ b/StdLib/Include/string.h
> @@ -62,6 +62,7 @@
> void *memset (void *s, int c, size_t n);
> char *strerror (int num);
> size_t strlen (const char *);
> + size_t strnlen (const char *s, size_t n);
>
> ################ BSD Compatibility Functions
> char *strdup (const char *);
> @@ -454,6 +455,16 @@ char *strerror(int Num);
> **/
> size_t strlen(const char *S);
>
> +/** The strnlen function computes the length of a fixed-size string.
> +
> + @param[in] S Pointer to the string to determine the length of.
> + @param[in] N Length of a string including the terminating character.
> +
> + @return The strnlen function returns the number of characters that
> + precede the terminating null character but not exceeding N.
> +**/
> +size_t strnlen(const char *S, size_t N);
> +
>
> /* ################ BSD Compatibility Functions ####################### */
>
> diff --git a/StdLib/LibC/String/Misc.c b/StdLib/LibC/String/Misc.c
> index f024136..8afffce 100644
> --- a/StdLib/LibC/String/Misc.c
> +++ b/StdLib/LibC/String/Misc.c
> @@ -99,3 +99,17 @@ strlen(const char *s)
> {
> return (size_t)AsciiStrLen( s);
> }
> +
> +/** The strnlen function computes the length of a fixed-size string.
> +
> + @param[in] s Pointer to the string to determine the length of.
> + @param[in] n Length of a string including the terminating character.
> +
> + @return The strnlen function returns the number of characters that
> + precede the terminating null character but not exceeding N.
> +**/
> +size_t
> +strnlen(const char *s, size_t n)
> +{
> + return (size_t)AsciiStrnLenS( s, n);
> +}
> --
> 2.34.0.windows.1
next prev parent reply other threads:[~2022-08-10 21:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-10 9:24 [PATCH v1] From: Mateusz Mówka <mateusz.mowka@intel.com> Subject: [edk2-libc] Add strnlen function wrapper mateusz.mowka
2022-08-10 21:26 ` Michael D Kinney [this message]
2022-11-30 8:39 ` [edk2-devel] " mateusz-mowka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CO1PR11MB492906C04986B4EEFDFEDED5D2659@CO1PR11MB4929.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox