Skip to content

Commit

Permalink
Merge pull request #5 from xiaoxiang781216/fix-void-cast
Browse files Browse the repository at this point in the history
Unify the void cast usage
  • Loading branch information
patacongo authored Jan 2, 2020
2 parents f00b4e6 + 8571584 commit 74ba8ff
Show file tree
Hide file tree
Showing 263 changed files with 1,038 additions and 1,047 deletions.
8 changes: 4 additions & 4 deletions builtin/exec_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv,
* be set appropriately).
*/

(void)posix_spawn_file_actions_destroy(&file_actions);
(void)posix_spawnattr_destroy(&attr);
posix_spawn_file_actions_destroy(&file_actions);
posix_spawnattr_destroy(&attr);
return pid;

errout_with_actions:
(void)posix_spawn_file_actions_destroy(&file_actions);
posix_spawn_file_actions_destroy(&file_actions);

errout_with_attrs:
(void)posix_spawnattr_destroy(&attr);
posix_spawnattr_destroy(&attr);

errout_with_errno:
set_errno(ret);
Expand Down
4 changes: 2 additions & 2 deletions examples/ajoystick/ajoy_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ static int ajoy_wait(int fd, FAR const struct timespec *timeout)

/* Wait for a signal */

(void)sigemptyset(&set);
(void)sigaddset(&set, CONFIG_EXAMPLES_AJOYSTICK_SIGNO);
sigemptyset(&set);
sigaddset(&set, CONFIG_EXAMPLES_AJOYSTICK_SIGNO);
ret = sigtimedwait(&set, &value, timeout);
if (ret < 0)
{
Expand Down
16 changes: 8 additions & 8 deletions examples/alarm/alarm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ static int alarm_daemon(int argc, FAR char *argv[])

/* Make sure that the alarm signal is unmasked */

(void)sigemptyset(&set);
(void)sigaddset(&set, CONFIG_EXAMPLES_ALARM_SIGNO);
sigemptyset(&set);
sigaddset(&set, CONFIG_EXAMPLES_ALARM_SIGNO);
ret = sigprocmask(SIG_UNBLOCK, &set, NULL);
if (ret != OK)
{
Expand All @@ -109,8 +109,8 @@ static int alarm_daemon(int argc, FAR char *argv[])
act.sa_sigaction = alarm_handler;
act.sa_flags = SA_SIGINFO;

(void)sigfillset(&act.sa_mask);
(void)sigdelset(&act.sa_mask, CONFIG_EXAMPLES_ALARM_SIGNO);
sigfillset(&act.sa_mask);
sigdelset(&act.sa_mask, CONFIG_EXAMPLES_ALARM_SIGNO);

ret = sigaction(CONFIG_EXAMPLES_ALARM_SIGNO, &act, NULL);
if (ret < 0)
Expand Down Expand Up @@ -325,7 +325,7 @@ int main(int argc, FAR char *argv[])
fprintf(stderr, "ERROR: RTC_RD_ALARM ioctl failed: %d\n",
errcode);

(void)close(fd);
close(fd);
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -380,7 +380,7 @@ int main(int argc, FAR char *argv[])
fprintf(stderr, "ERROR: RTC_CANCEL_ALARM ioctl failed: %d\n",
errcode);

(void)close(fd);
close(fd);
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -409,13 +409,13 @@ int main(int argc, FAR char *argv[])
fprintf(stderr, "ERROR: RTC_SET_RELATIVE ioctl failed: %d\n",
errcode);

(void)close(fd);
close(fd);
return EXIT_FAILURE;
}

printf("Alarm %d set in %lu seconds\n", alarmid, seconds);
}

(void)close(fd);
close(fd);
return EXIT_SUCCESS;
}
6 changes: 3 additions & 3 deletions examples/buttons/buttons_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ static int button_daemon(int argc, char *argv[])
#ifdef CONFIG_EXAMPLES_BUTTONS_SIGNAL
/* Wait for a signal */

(void)sigemptyset(&set);
(void)sigaddset(&set, CONFIG_EXAMPLES_BUTTONS_SIGNO);
sigemptyset(&set);
sigaddset(&set, CONFIG_EXAMPLES_BUTTONS_SIGNO);
ret = sigwaitinfo(&set, &value);
if (ret < 0)
{
Expand Down Expand Up @@ -366,7 +366,7 @@ static int button_daemon(int argc, char *argv[])
}

errout_with_fd:
(void)close(fd);
close(fd);

errout:
g_button_daemon_started = false;
Expand Down
2 changes: 1 addition & 1 deletion examples/calib_udelay/calib_udelay_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static uint64_t gettime_nsecs(void)
struct timespec ts;
uint64_t nsecs;

(void)clock_gettime(CLOCK_MONOTONIC, &ts);
clock_gettime(CLOCK_MONOTONIC, &ts);

nsecs = ts.tv_sec;
nsecs *= 1000 * 1000 * 1000;
Expand Down
24 changes: 11 additions & 13 deletions examples/canard/canard_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ static void onTransferReceived(CanardInstance *ins,
(uint16_t) total_size);
if (resp_res <= 0)
{
(void)fprintf(stderr, "Could not respond to GetNodeInfo; error %d\n",
resp_res);
fprintf(stderr, "Could not respond to GetNodeInfo; error %d\n",
resp_res);
}
}
}
Expand All @@ -257,8 +257,6 @@ static bool shouldAcceptTransfer(const CanardInstance * ins,
CanardTransferType transfer_type,
uint8_t source_node_id)
{
(void)source_node_id;

if (canardGetLocalNodeID(ins) == CANARD_BROADCAST_NODE_ID)
{
/* If we're in the process of allocation of dynamic node ID, accept
Expand Down Expand Up @@ -335,8 +333,8 @@ void process1HzTasks(uint64_t timestamp_usec)
buffer, UAVCAN_NODE_STATUS_MESSAGE_SIZE);
if (bc_res <= 0)
{
(void)fprintf(stderr, "Could not broadcast node status; error %d\n",
bc_res);
fprintf(stderr, "Could not broadcast node status; error %d\n",
bc_res);
}
}

Expand All @@ -352,8 +350,8 @@ void process1HzTasks(uint64_t timestamp_usec)
payload, 0);
if (resp_res <= 0)
{
(void)fprintf(stderr, "Could not request GetNodeInfo; error %d\n",
resp_res);
fprintf(stderr, "Could not request GetNodeInfo; error %d\n",
resp_res);
}
}

Expand All @@ -380,9 +378,9 @@ void processTxRxOnce(CanardNuttXInstance * nuttxcan, int timeout_msec)
if (tx_res < 0) /* Failure - drop the frame and report */
{
canardPopTxQueue(&canard);
(void)fprintf(stderr,
"Transmit error %d, frame dropped, errno '%s'\n",
tx_res, strerror(errno));
fprintf(stderr,
"Transmit error %d, frame dropped, errno '%s'\n",
tx_res, strerror(errno));
}
else if (tx_res > 0) /* Success - just drop the frame */
{
Expand All @@ -402,8 +400,8 @@ void processTxRxOnce(CanardNuttXInstance * nuttxcan, int timeout_msec)

if (rx_res < 0) /* Failure - report */
{
(void)fprintf(stderr, "Receive error %d, errno '%s'\n", rx_res,
strerror(errno));
fprintf(stderr, "Receive error %d, errno '%s'\n", rx_res,
strerror(errno));
}
else if (rx_res > 0) /* Success - process the frame */
{
Expand Down
12 changes: 6 additions & 6 deletions examples/chrono/chrono_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ static int button_daemon(int argc, char *argv[])

/* Wait for a signal */

(void)sigemptyset(&set);
(void)sigaddset(&set, BUTTON_SIGNO);
sigemptyset(&set);
sigaddset(&set, BUTTON_SIGNO);
ret = sigwaitinfo(&set, &value);
if (ret < 0)
{
Expand All @@ -198,7 +198,7 @@ static int button_daemon(int argc, char *argv[])

if (priv->state == CHRONO_STOPPED)
{
(void)clock_gettime(CLOCK_MONOTONIC, &priv->ts_start);
clock_gettime(CLOCK_MONOTONIC, &priv->ts_start);
priv->state = CHRONO_RUNNING;
}
else
Expand All @@ -214,7 +214,7 @@ static int button_daemon(int argc, char *argv[])
}

errout_with_fd:
(void)close(fd);
close(fd);

errout:

Expand Down Expand Up @@ -284,7 +284,7 @@ static void slcd_putc(FAR struct lib_outstream_s *stream, int ch)

if (stream->nput >= CONFIG_EXAMPLES_SLCD_BUFSIZE)
{
(void)slcd_flush(stream);
slcd_flush(stream);
}
}

Expand Down Expand Up @@ -427,7 +427,7 @@ int main(int argc, FAR char *argv[])
{
/* Get the current time */

(void)clock_gettime(CLOCK_MONOTONIC, &priv->ts_end);
clock_gettime(CLOCK_MONOTONIC, &priv->ts_end);

/* How many seconds passed from initial time? */

Expand Down
8 changes: 4 additions & 4 deletions examples/configdata/configdata_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static void configdata_loopmemusage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif

/* Show the change from the previous loop */
Expand All @@ -206,7 +206,7 @@ static void configdata_endmemusage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
printf("\nFinal memory usage:\n");
configdata_showmemusage(&g_mmbefore, &g_mmafter);
Expand Down Expand Up @@ -682,7 +682,7 @@ int main(int argc, FAR char *argv[])
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmbefore = mallinfo();
#else
(void)mallinfo(&g_mmbefore);
mallinfo(&g_mmbefore);
#endif

/* Loop seveal times ... create some config data items, delete them
Expand All @@ -706,7 +706,7 @@ int main(int argc, FAR char *argv[])
#ifndef CONFIG_EXAMPLES_CONFIGDATA_SILENT
printf("\n=== FILLING %u =============================\n", i);
#endif
(void)configdata_fillconfig();
configdata_fillconfig();
#ifndef CONFIG_EXAMPLES_CONFIGDATA_SILENT
printf("Filled /dev/config\n");
printf(" Number of entries: %d\n", g_nentries);
Expand Down
2 changes: 1 addition & 1 deletion examples/discover/discover_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int main(int argc, FAR char *argv[])
if (handle)
{
struct dhcpc_state ds;
(void)dhcpc_request(handle, &ds);
dhcpc_request(handle, &ds);
netlib_set_ipv4addr("eth0", &ds.ipaddr);

if (ds.netmask.s_addr != 0)
Expand Down
4 changes: 2 additions & 2 deletions examples/djoystick/djoy_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ int main(int argc, FAR char *argv[])

/* Wait for a signal */

(void)sigemptyset(&set);
(void)sigaddset(&set, CONFIG_EXAMPLES_DJOYSTICK_SIGNO);
sigemptyset(&set);
sigaddset(&set, CONFIG_EXAMPLES_DJOYSTICK_SIGNO);
ret = sigwaitinfo(&set, &value);
if (ret < 0)
{
Expand Down
6 changes: 3 additions & 3 deletions examples/elf/elf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static void mm_update(FAR unsigned int *previous, FAR const char *msg)
#ifdef CONFIG_CAN_PASS_STRUCTS
mmcurrent = mallinfo();
#else
(void)mallinfo(&mmcurrent);
mallinfo(&mmcurrent);
#endif

/* Show the change from the previous time */
Expand All @@ -207,7 +207,7 @@ static void mm_initmonitor(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
mmcurrent = mallinfo();
#else
(void)mallinfo(&mmcurrent);
mallinfo(&mmcurrent);
#endif

g_mminitial = mmcurrent.uordblks;
Expand Down Expand Up @@ -362,7 +362,7 @@ int main(int argc, FAR char *argv[])
* the ROMFS mountpoint.
*/

(void)setenv("PATH", MOUNTPT, 1);
setenv("PATH", MOUNTPT, 1);
#endif

/* Now exercise every program in the ROMFS file system */
Expand Down
2 changes: 1 addition & 1 deletion examples/elf/tests/signal/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ int main(int argc, char **argv)
act.sa_sigaction = siguser_action;
act.sa_flags = SA_SIGINFO;

(void)sigemptyset(&act.sa_mask);
sigemptyset(&act.sa_mask);

status = sigaction(SIGUSR1, &act, &oact1);
if (status != 0)
Expand Down
Loading

0 comments on commit 74ba8ff

Please sign in to comment.