From f8d425f0ad35b5205d2ba4ae75f535df4432e839 Mon Sep 17 00:00:00 2001 From: Pierre-noel Bouteville Date: Tue, 12 Jul 2016 16:27:14 -0600 Subject: [PATCH 1/2] apps/netutils/cJSON: Eliminate some warnings --- include/netutils/cJSON.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/netutils/cJSON.h b/include/netutils/cJSON.h index 6fc8474d6..cd4b38f1c 100644 --- a/include/netutils/cJSON.h +++ b/include/netutils/cJSON.h @@ -154,18 +154,18 @@ cJSON *cJSON_GetObjectItem(cJSON *object, const char *string); * Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ -const char *cJSON_GetErrorPtr(); +const char *cJSON_GetErrorPtr(void); /* These calls create a cJSON item of the appropriate type. */ -cJSON *cJSON_CreateNull(); -cJSON *cJSON_CreateTrue(); -cJSON *cJSON_CreateFalse(); +cJSON *cJSON_CreateNull(void); +cJSON *cJSON_CreateTrue(void); +cJSON *cJSON_CreateFalse(void); cJSON *cJSON_CreateBool(int b); cJSON *cJSON_CreateNumber(double num); cJSON *cJSON_CreateString(const char *string); -cJSON *cJSON_CreateArray(); -cJSON *cJSON_CreateObject(); +cJSON *cJSON_CreateArray(void); +cJSON *cJSON_CreateObject(void); /* These utilities create an Array of count items. */ From dd7c4c94935889fee77d79a188b62f11aa3fb0c6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 13 Jul 2016 07:06:32 -0600 Subject: [PATCH 2/2] NSH library: Don't show stack usage is CONFIG_STACK_COLORATION is not enabled. --- nshlib/nsh_proccmds.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c index 4ae4ac452..0ebbbe559 100644 --- a/nshlib/nsh_proccmds.c +++ b/nshlib/nsh_proccmds.c @@ -132,8 +132,10 @@ static const char g_sigmask[] = "SigMask:"; #if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) static const char g_stacksize[] = "StackSize:"; +#ifdef CONFIG_STACK_COLORATION static const char g_stackused[] = "StackUsed:"; #endif +#endif /**************************************************************************** * Private Functions @@ -268,8 +270,10 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, int i; #if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) uint32_t stack_size; +#ifdef CONFIG_STACK_COLORATION uint32_t stack_used; uint32_t stack_filled; +#endif #endif /* Task/thread entries in the /proc directory will all be (1) directories @@ -391,7 +395,9 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, /* Get the StackSize and StackUsed */ stack_size = 0; +#ifdef CONFIG_STACK_COLORATION stack_used = 0; +#endif filepath = NULL; ret = asprintf(&filepath, "%s/%s/stack", dirpath, entryp->d_name); @@ -444,16 +450,20 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, { stack_size = (uint32_t)atoi(&line[12]); } +#ifdef CONFIG_STACK_COLORATION else if (strncmp(line, g_stackused, strlen(g_stackused)) == 0) { stack_used = (uint32_t)atoi(&line[12]); } +#endif } while (nextline != NULL); } } nsh_output(vtbl, "%6.6u ", (unsigned int)stack_size); + +#ifdef CONFIG_STACK_COLORATION nsh_output(vtbl, "%6.6u ", (unsigned int)stack_used); stack_filled = 0; @@ -470,6 +480,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, stack_filled / 10, stack_filled % 10, (stack_filled >= 10 * 80 ? "!" : " ")); #endif +#endif #ifdef NSH_HAVE_CPULOAD /* Get the CPU load */ @@ -572,11 +583,15 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifndef CONFIG_DISABLE_SIGNALS nsh_output(vtbl, "%-8s ", "SIGMASK"); #endif + #if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) nsh_output(vtbl, "%6s ", "STACK"); +#ifdef CONFIG_STACK_COLORATION nsh_output(vtbl, "%6s ", "USED"); nsh_output(vtbl, "%7s ", "FILLED"); #endif +#endif + #ifdef NSH_HAVE_CPULOAD nsh_output(vtbl, "%6s ", "CPU"); #endif