apps/nshlib/nsh_parse.c: Fix warning: 'g_nullstring defined but not used'. Use directly since the usage is triggered by a complex Kconfig combination.

This commit is contained in:
Xiang Xiao 2019-12-18 09:43:31 -06:00 committed by Gregory Nutt
parent 3a2bd2c05f
commit 9defae8af6

View File

@ -222,7 +222,6 @@ static const char g_exitstatus[] = "?";
static const char g_success[] = "0"; static const char g_success[] = "0";
static const char g_failure[] = "1"; static const char g_failure[] = "1";
#endif #endif
static const char g_nullstring[] = "";
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
@ -887,7 +886,7 @@ static FAR char *nsh_cmdparm(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
if (!allocation) if (!allocation)
{ {
return (FAR char *)g_nullstring; return "";
} }
/* Create a unique file name using the task ID */ /* Create a unique file name using the task ID */
@ -897,7 +896,7 @@ static FAR char *nsh_cmdparm(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
if (ret < 0 || !tmpfile) if (ret < 0 || !tmpfile)
{ {
nsh_error(vtbl, g_fmtcmdoutofmemory, "``"); nsh_error(vtbl, g_fmtcmdoutofmemory, "``");
return (FAR char *)g_nullstring; return "";
} }
/* Execute the command that will re-direct the output of the command to /* Execute the command that will re-direct the output of the command to
@ -912,7 +911,7 @@ static FAR char *nsh_cmdparm(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
nsh_error(vtbl, g_fmtcmdfailed, "``", "exec", NSH_ERRNO); nsh_error(vtbl, g_fmtcmdfailed, "``", "exec", NSH_ERRNO);
free(tmpfile); free(tmpfile);
return (FAR char *)g_nullstring; return "";
} }
/* Concatenate the file contents with the current allocation */ /* Concatenate the file contents with the current allocation */
@ -1053,7 +1052,7 @@ static FAR char *nsh_envexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *varname)
} }
#endif #endif
return (FAR char *)g_nullstring; return "";
} }
} }
#endif #endif
@ -1232,7 +1231,7 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
if (!rptr) if (!rptr)
{ {
nsh_error(vtbl, g_fmtnomatching, "`", "`"); nsh_error(vtbl, g_fmtnomatching, "`", "`");
return (FAR char *)g_nullstring; return "";
} }
/* Replace the final back-quote with a NUL terminator */ /* Replace the final back-quote with a NUL terminator */
@ -1240,7 +1239,7 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
*rptr = '\0'; *rptr = '\0';
/* Then execute the command to get the sub-string value. On /* Then execute the command to get the sub-string value. On
* error, nsh_cmdparm may return g_nullstring but never NULL. * error, nsh_cmdparm may return null string but never NULL.
*/ */
result = nsh_cmdparm(vtbl, ptr, &tmpalloc); result = nsh_cmdparm(vtbl, ptr, &tmpalloc);
@ -1299,7 +1298,7 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
if (!rptr) if (!rptr)
{ {
nsh_error(vtbl, g_fmtnomatching, "${", "}"); nsh_error(vtbl, g_fmtnomatching, "${", "}");
return (FAR char *)g_nullstring; return "";
} }
/* Replace the right bracket with a NUL terminator and set the /* Replace the right bracket with a NUL terminator and set the
@ -1367,7 +1366,7 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline, static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
FAR char **allocation, FAR int *isenvvar) FAR char **allocation, FAR int *isenvvar)
{ {
FAR char *argument = (FAR char *)g_nullstring; FAR char *argument = "";
#ifdef CONFIG_NSH_QUOTE #ifdef CONFIG_NSH_QUOTE
char ch = *cmdline; char ch = *cmdline;
@ -1396,7 +1395,7 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
if (!rptr || rptr[1] != '\0') if (!rptr || rptr[1] != '\0')
{ {
nsh_error(vtbl, g_fmtnomatching, "`", "`"); nsh_error(vtbl, g_fmtnomatching, "`", "`");
return (FAR char *)g_nullstring; return "";
} }
/* Replace the final back-quote with a NUL terminator */ /* Replace the final back-quote with a NUL terminator */