Replace strlen with sizeof for kconfig string

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-09-01 11:00:38 +08:00 committed by Petro Karashchenko
parent 956b935511
commit 6aa05b5855
5 changed files with 7 additions and 7 deletions

View File

@ -89,7 +89,7 @@ int main(int argc, FAR char *argv[])
/* Set up the server address */
addrlen = strlen(CONFIG_EXAMPLES_UDGRAM_ADDR) + 1;
addrlen = sizeof(CONFIG_EXAMPLES_UDGRAM_ADDR);
if (addrlen > UNIX_PATH_MAX)
{
addrlen = UNIX_PATH_MAX;

View File

@ -91,7 +91,7 @@ int main(int argc, FAR char *argv[])
/* Bind the socket to a local address */
addrlen = strlen(CONFIG_EXAMPLES_UDGRAM_ADDR) + 1;
addrlen = sizeof(CONFIG_EXAMPLES_UDGRAM_ADDR);
if (addrlen > UNIX_PATH_MAX)
{
addrlen = UNIX_PATH_MAX;

View File

@ -78,7 +78,7 @@ int main(int argc, FAR char *argv[])
/* Connect the socket to the server */
addrlen = strlen(CONFIG_EXAMPLES_USTREAM_ADDR) + 1;
addrlen = sizeof(CONFIG_EXAMPLES_USTREAM_ADDR);
if (addrlen > UNIX_PATH_MAX)
{
addrlen = UNIX_PATH_MAX;

View File

@ -78,7 +78,7 @@ int main(int argc, char *argv[])
/* Bind the socket to a local address */
addrlen = strlen(CONFIG_EXAMPLES_USTREAM_ADDR) + 1;
addrlen = sizeof(CONFIG_EXAMPLES_USTREAM_ADDR);
if (addrlen > UNIX_PATH_MAX)
{
addrlen = UNIX_PATH_MAX;

View File

@ -142,7 +142,7 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
{
#if defined(CONFIG_NSH_PROC_MOUNTPOINT)
if (strncmp(filepath, CONFIG_NSH_PROC_MOUNTPOINT,
strlen(CONFIG_NSH_PROC_MOUNTPOINT)) == 0)
sizeof(CONFIG_NSH_PROC_MOUNTPOINT) - 1) == 0)
{
nsh_error(vtbl,
"nsh: %s: Could not open %s (is procfs mounted?)\n",
@ -386,7 +386,7 @@ int nsh_writefile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
{
#if defined(CONFIG_NSH_PROC_MOUNTPOINT)
if (strncmp(filepath, CONFIG_NSH_PROC_MOUNTPOINT,
strlen(CONFIG_NSH_PROC_MOUNTPOINT)) == 0)
sizeof(CONFIG_NSH_PROC_MOUNTPOINT) - 1) == 0)
{
nsh_error(vtbl,
"nsh: %s: Could not open %s (is procfs mounted?)\n",
@ -445,7 +445,7 @@ int nsh_foreach_direntry(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
#if defined(CONFIG_NSH_PROC_MOUNTPOINT)
if (strncmp(dirpath, CONFIG_NSH_PROC_MOUNTPOINT,
strlen(CONFIG_NSH_PROC_MOUNTPOINT)) == 0)
sizeof(CONFIG_NSH_PROC_MOUNTPOINT) - 1) == 0)
{
nsh_error(vtbl,
"nsh: %s: Could not open %s (is procfs mounted?)\n",