Skip to content

Commit 9defae8

Browse files
xiaoxiang781216gregory-nutt
authored andcommitted
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.
1 parent 3a2bd2c commit 9defae8

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

nshlib/nsh_parse.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ static const char g_exitstatus[] = "?";
222222
static const char g_success[] = "0";
223223
static const char g_failure[] = "1";
224224
#endif
225-
static const char g_nullstring[] = "";
226225

227226
/****************************************************************************
228227
* Public Data
@@ -887,7 +886,7 @@ static FAR char *nsh_cmdparm(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
887886

888887
if (!allocation)
889888
{
890-
return (FAR char *)g_nullstring;
889+
return "";
891890
}
892891

893892
/* 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,
897896
if (ret < 0 || !tmpfile)
898897
{
899898
nsh_error(vtbl, g_fmtcmdoutofmemory, "``");
900-
return (FAR char *)g_nullstring;
899+
return "";
901900
}
902901

903902
/* 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,
912911

913912
nsh_error(vtbl, g_fmtcmdfailed, "``", "exec", NSH_ERRNO);
914913
free(tmpfile);
915-
return (FAR char *)g_nullstring;
914+
return "";
916915
}
917916

918917
/* 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)
10531052
}
10541053
#endif
10551054

1056-
return (FAR char *)g_nullstring;
1055+
return "";
10571056
}
10581057
}
10591058
#endif
@@ -1232,15 +1231,15 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
12321231
if (!rptr)
12331232
{
12341233
nsh_error(vtbl, g_fmtnomatching, "`", "`");
1235-
return (FAR char *)g_nullstring;
1234+
return "";
12361235
}
12371236

12381237
/* Replace the final back-quote with a NUL terminator */
12391238

12401239
*rptr = '\0';
12411240

12421241
/* Then execute the command to get the sub-string value. On
1243-
* error, nsh_cmdparm may return g_nullstring but never NULL.
1242+
* error, nsh_cmdparm may return null string but never NULL.
12441243
*/
12451244

12461245
result = nsh_cmdparm(vtbl, ptr, &tmpalloc);
@@ -1299,7 +1298,7 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
12991298
if (!rptr)
13001299
{
13011300
nsh_error(vtbl, g_fmtnomatching, "${", "}");
1302-
return (FAR char *)g_nullstring;
1301+
return "";
13031302
}
13041303

13051304
/* 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,
13671366
static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
13681367
FAR char **allocation, FAR int *isenvvar)
13691368
{
1370-
FAR char *argument = (FAR char *)g_nullstring;
1369+
FAR char *argument = "";
13711370
#ifdef CONFIG_NSH_QUOTE
13721371
char ch = *cmdline;
13731372

@@ -1396,7 +1395,7 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
13961395
if (!rptr || rptr[1] != '\0')
13971396
{
13981397
nsh_error(vtbl, g_fmtnomatching, "`", "`");
1399-
return (FAR char *)g_nullstring;
1398+
return "";
14001399
}
14011400

14021401
/* Replace the final back-quote with a NUL terminator */

0 commit comments

Comments
 (0)