Miscellaneous fixes from astyle tool.

This commit is contained in:
Arjun Hary
2017-08-14 17:19:27 -06:00
committed by Gregory Nutt
parent 777169385c
commit b274a97840
63 changed files with 422 additions and 418 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ static long compare_timespec(FAR const struct timespec *a,
return 1; return 1;
} }
return (long)a->tv_nsec -(long)b->tv_nsec; return (long)a->tv_nsec - (long)b->tv_nsec;
} }
/**************************************************************************** /****************************************************************************
+1 -1
View File
@@ -80,5 +80,5 @@ static const uint8_t g_lookup[12] = {2, 5, 7, 10, 12, 15, 17, 20, 23, 25, 28, 30
int clock_dow(int year, int month, int day) int clock_dow(int year, int month, int day)
{ {
day += month < 2 ? year-- : year - 2; day += month < 2 ? year-- : year - 2;
return ((int)g_lookup[month] + day + 4 + year/4 - year/100 + year/400) % 7; return ((int)g_lookup[month] + day + 4 + year / 4 - year / 100 + year / 400) % 7;
} }
+1 -1
View File
@@ -102,7 +102,7 @@ int putenv(FAR const char *string)
/* Then let setenv do all of the work */ /* Then let setenv do all of the work */
*pequal = '\0'; *pequal = '\0';
ret = setenv(pname, pequal+1, TRUE); ret = setenv(pname, pequal + 1, TRUE);
} }
kmm_free(pname); kmm_free(pname);
+1 -1
View File
@@ -296,7 +296,7 @@ int group_initialize(FAR struct task_tcb_s *tcb)
#ifdef HAVE_GROUP_MEMBERS #ifdef HAVE_GROUP_MEMBERS
/* Allocate space to hold GROUP_INITIAL_MEMBERS members of the group */ /* Allocate space to hold GROUP_INITIAL_MEMBERS members of the group */
group->tg_members = (FAR pid_t *)kmm_malloc(GROUP_INITIAL_MEMBERS*sizeof(pid_t)); group->tg_members = (FAR pid_t *)kmm_malloc(GROUP_INITIAL_MEMBERS * sizeof(pid_t));
if (!group->tg_members) if (!group->tg_members)
{ {
kmm_free(group); kmm_free(group);
+3 -3
View File
@@ -71,7 +71,7 @@
#include "timer/timer.h" #include "timer/timer.h"
#include "irq/irq.h" #include "irq/irq.h"
#ifdef HAVE_TASK_GROUP #ifdef HAVE_TASK_GROUP
#include "group/group.h" # include "group/group.h"
#endif #endif
#include "init/init.h" #include "init/init.h"
@@ -100,7 +100,7 @@
/* This is the list of all tasks that are ready to run. This is a /* This is the list of all tasks that are ready to run. This is a
* prioritized list with head of the list holding the highest priority * prioritized list with head of the list holding the highest priority
* (unassigned) task. In the non-SMP cae, the head of this list is the * (unassigned) task. In the non-SMP case, the head of this list is the
* currently active task and the tail of this list, the lowest priority * currently active task and the tail of this list, the lowest priority
* task, is always the IDLE task. * task, is always the IDLE task.
*/ */
@@ -109,7 +109,7 @@ volatile dq_queue_t g_readytorun;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* In order to support SMP, the function of the g_readytorun list changes, /* In order to support SMP, the function of the g_readytorun list changes,
* The g_readytorun is still used but in the SMP cae it will contain only: * The g_readytorun is still used but in the SMP case it will contain only:
* *
* - Only tasks/threads that are eligible to run, but not currently running, * - Only tasks/threads that are eligible to run, but not currently running,
* and * and
+1 -1
View File
@@ -496,7 +496,7 @@ void leave_critical_section(irqstate_t flags)
} }
else else
{ {
#ifdef CONFIG_SCHED_INSTRUMENTATION_CSECTION #ifdef CONFIG_SCHED_INSTRUMENTATION_CSECTION
/* No.. Note that we have left the critical section */ /* No.. Note that we have left the critical section */
sched_note_csection(rtcb, false); sched_note_csection(rtcb, false);
+1 -1
View File
@@ -95,7 +95,7 @@ static void mod_dumploadinfo(FAR struct mod_loadinfo_s *loadinfo)
binfo(" e_entry: %08lx\n", (long)loadinfo->ehdr.e_entry); binfo(" e_entry: %08lx\n", (long)loadinfo->ehdr.e_entry);
binfo(" e_phoff: %d\n", loadinfo->ehdr.e_phoff); binfo(" e_phoff: %d\n", loadinfo->ehdr.e_phoff);
binfo(" e_shoff: %d\n", loadinfo->ehdr.e_shoff); binfo(" e_shoff: %d\n", loadinfo->ehdr.e_shoff);
binfo(" e_flags: %08x\n" , loadinfo->ehdr.e_flags); binfo(" e_flags: %08x\n", loadinfo->ehdr.e_flags);
binfo(" e_ehsize: %d\n", loadinfo->ehdr.e_ehsize); binfo(" e_ehsize: %d\n", loadinfo->ehdr.e_ehsize);
binfo(" e_phentsize: %d\n", loadinfo->ehdr.e_phentsize); binfo(" e_phentsize: %d\n", loadinfo->ehdr.e_phentsize);
binfo(" e_phnum: %d\n", loadinfo->ehdr.e_phnum); binfo(" e_phnum: %d\n", loadinfo->ehdr.e_phnum);
+2 -2
View File
@@ -331,7 +331,7 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
leave_cancellation_point(); leave_cancellation_point();
return ret; return ret;
/* Exit here with (1) the scheduler locked, (2) a message allocated, (3) a /* Exit here with (1) the scheduler locked, (2) a message allocated, (3) a
* wdog allocated, and (4) interrupts disabled. The error code is in * wdog allocated, and (4) interrupts disabled. The error code is in
* 'result' * 'result'
*/ */
@@ -341,7 +341,7 @@ errout_in_critical_section:
wd_delete(rtcb->waitdog); wd_delete(rtcb->waitdog);
rtcb->waitdog = NULL; rtcb->waitdog = NULL;
/* Exit here with (1) the scheduler locked and 2) a message allocated. The /* Exit here with (1) the scheduler locked and 2) a message allocated. The
* error code is in 'result' * error code is in 'result'
*/ */
+1 -1
View File
@@ -79,7 +79,7 @@ static bool pthread_notifywaiters(FAR struct join_s *pjoin)
* awakened when all waiting tasks receive the data * awakened when all waiting tasks receive the data
*/ */
(void)sem_init(&pjoin->data_sem, 0, (ntasks_waiting+1)); (void)sem_init(&pjoin->data_sem, 0, (ntasks_waiting + 1));
/* Post the semaphore to restart each thread that is waiting /* Post the semaphore to restart each thread that is waiting
* on the semaphore * on the semaphore
+1 -1
View File
@@ -152,7 +152,7 @@ struct tasklist_s
/* This is the list of all tasks that are ready to run. This is a /* This is the list of all tasks that are ready to run. This is a
* prioritized list with head of the list holding the highest priority * prioritized list with head of the list holding the highest priority
* (unassigned) task. In the non-SMP cae, the head of this list is the * (unassigned) task. In the non-SMP case, the head of this list is the
* currently active task and the tail of this list, the lowest priority * currently active task and the tail of this list, the lowest priority
* task, is always the IDLE task. * task, is always the IDLE task.
*/ */
+1 -1
View File
@@ -37,7 +37,7 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <stdbool.h> #include <stdbool.h>
+1 -1
View File
@@ -84,7 +84,7 @@ pid_t wait(FAR int *stat_loc)
* trivial case. * trivial case.
*/ */
return waitpid((pid_t)-1, stat_loc, 0); return waitpid((pid_t) - 1, stat_loc, 0);
} }
#endif /* CONFIG_SCHED_WAITPID && CONFIG_SCHED_HAVE_PARENT */ #endif /* CONFIG_SCHED_WAITPID && CONFIG_SCHED_HAVE_PARENT */
+1 -1
View File
@@ -224,7 +224,7 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
#ifdef HAVE_GROUP_MEMBERS #ifdef HAVE_GROUP_MEMBERS
if (ctcb == NULL || ctcb->group->tg_pgid != rtcb->group->tg_gid) if (ctcb == NULL || ctcb->group->tg_pgid != rtcb->group->tg_gid)
#else #else
if (ctcb == NULL || ctcb->group>tg_ppid != rtcb->pid) if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid)
#endif #endif
{ {
errcode = ECHILD; errcode = ECHILD;
+8 -4
View File
@@ -861,12 +861,12 @@ void sem_initholders(void)
/* Put all of the pre-allocated holder structures into the free list */ /* Put all of the pre-allocated holder structures into the free list */
g_freeholders = g_holderalloc; g_freeholders = g_holderalloc;
for (i = 0; i < (CONFIG_SEM_PREALLOCHOLDERS-1); i++) for (i = 0; i < (CONFIG_SEM_PREALLOCHOLDERS - 1); i++)
{ {
g_holderalloc[i].flink = &g_holderalloc[i+1]; g_holderalloc[i].flink = &g_holderalloc[i + 1];
} }
g_holderalloc[CONFIG_SEM_PREALLOCHOLDERS-1].flink = NULL; g_holderalloc[CONFIG_SEM_PREALLOCHOLDERS - 1].flink = NULL;
#endif #endif
} }
@@ -1189,7 +1189,11 @@ int sem_nfreeholders(void)
FAR struct semholder_s *pholder; FAR struct semholder_s *pholder;
int n; int n;
for (pholder = g_freeholders, n = 0; pholder; pholder = pholder->flink) n++; for (pholder = g_freeholders, n = 0; pholder; pholder = pholder->flink)
{
n++;
}
return n; return n;
#else #else
return 0; return 0;
+1 -1
View File
@@ -259,7 +259,7 @@ int task_create(FAR const char *name, int priority,
****************************************************************************/ ****************************************************************************/
int kernel_thread(FAR const char *name, int priority, int kernel_thread(FAR const char *name, int priority,
int stack_size, main_t entry, FAR char * const argv[]) int stack_size, main_t entry, FAR char *const argv[])
{ {
return thread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size, return thread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size,
entry, argv); entry, argv);
+2 -2
View File
@@ -94,7 +94,7 @@ static inline void task_atexit(FAR struct tcb_s *tcb)
* group exits, i.e., from higher to lower indices. * group exits, i.e., from higher to lower indices.
*/ */
for (index = CONFIG_SCHED_ATEXIT_MAX-1; index >= 0; index--) for (index = CONFIG_SCHED_ATEXIT_MAX - 1; index >= 0; index--)
{ {
if (group->tg_atexitfunc[index]) if (group->tg_atexitfunc[index])
{ {
@@ -162,7 +162,7 @@ static inline void task_onexit(FAR struct tcb_s *tcb, int status)
* when the task group exits, i.e., from higher to lower indices. * when the task group exits, i.e., from higher to lower indices.
*/ */
for (index = CONFIG_SCHED_ONEXIT_MAX-1; index >= 0; index--) for (index = CONFIG_SCHED_ONEXIT_MAX - 1; index >= 0; index--)
{ {
if (group->tg_onexitfunc[index]) if (group->tg_onexitfunc[index])
{ {
+2 -2
View File
@@ -142,8 +142,8 @@ int prctl(int option, ...)
* necessary. * necessary.
*/ */
strncpy(name, tcb->name, CONFIG_TASK_NAME_SIZE-1); strncpy(name, tcb->name, CONFIG_TASK_NAME_SIZE - 1);
name[CONFIG_TASK_NAME_SIZE-1] = '\0'; name[CONFIG_TASK_NAME_SIZE - 1] = '\0';
} }
} }
break; break;
+1 -1
View File
@@ -592,7 +592,7 @@ static inline int task_stackargsetup(FAR struct task_tcb_s *tcb,
* argument and its NUL terminator in the string buffer. * argument and its NUL terminator in the string buffer.
*/ */
stackargv[i+1] = str; stackargv[i + 1] = str;
nbytes = strlen(argv[i]) + 1; nbytes = strlen(argv[i]) + 1;
strcpy(str, argv[i]); strcpy(str, argv[i]);
str += nbytes; str += nbytes;