This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 6b8274f libc: Change the return type of strerror from "const char *"
to "char *"
6b8274f is described below
commit 6b8274fbd86b95d09a15c0e967791b76b282d358
Author: Xiang Xiao <[email protected]>
AuthorDate: Sun Mar 20 17:58:42 2022 +0800
libc: Change the return type of strerror from "const char *" to "char *"
to follow up the spec here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html
Signed-off-by: Xiang Xiao <[email protected]>
---
include/string.h | 2 +-
libs/libc/libc.csv | 2 +-
libs/libc/string/lib_strerror.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/string.h b/include/string.h
index c42bb82..d202d08 100644
--- a/include/string.h
+++ b/include/string.h
@@ -53,7 +53,7 @@ extern "C"
FAR char *strdup(FAR const char *s);
FAR char *strndup(FAR const char *s, size_t size);
-FAR const char *strerror(int);
+FAR char *strerror(int);
int strerror_r(int, FAR char *, size_t);
size_t strlen(FAR const char *);
size_t strnlen(FAR const char *, size_t);
diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv
index b0236c2..5054e92 100644
--- a/libs/libc/libc.csv
+++ b/libs/libc/libc.csv
@@ -225,7 +225,7 @@
"strcpy","string.h","","FAR char *","FAR char *","FAR const char *"
"strcspn","string.h","","size_t","FAR const char *","FAR const char *"
"strdup","string.h","","FAR char *","FAR const char *"
-"strerror","string.h","","FAR const char *","int"
+"strerror","string.h","","FAR char *","int"
"strerror_r","string.h","","int","int","FAR char *","size_t"
"strftime","time.h","","size_t","FAR char *","size_t","FAR const char *","FAR
const struct tm *"
"strlen","string.h","","size_t","FAR const char *"
diff --git a/libs/libc/string/lib_strerror.c b/libs/libc/string/lib_strerror.c
index 82625df..bf1ee82 100644
--- a/libs/libc/string/lib_strerror.c
+++ b/libs/libc/string/lib_strerror.c
@@ -38,8 +38,8 @@
struct errno_strmap_s
{
- uint8_t errnum;
- const char *str;
+ uint8_t errnum;
+ FAR char *str;
};
/****************************************************************************
@@ -341,7 +341,7 @@ static const struct errno_strmap_s g_errnomap[] =
* Name: strerror
****************************************************************************/
-FAR const char *strerror(int errnum)
+FAR char *strerror(int errnum)
{
#ifdef CONFIG_LIBC_STRERROR
int ndxlow = 0;