From 61d457dfc81685b896947f75d9988899153dd977 Mon Sep 17 00:00:00 2001 From: zenon Date: Sat, 9 Jun 2018 12:59:21 +0200 Subject: [PATCH] Add static to each function to limit visibility --- supervisor.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/supervisor.c b/supervisor.c index 4b266b9..ffc17fe 100644 --- a/supervisor.c +++ b/supervisor.c @@ -21,7 +21,7 @@ struct circ_buf *shared; /** * @details File descriptor for shared memory. */ -int shmfd; +static int shmfd; /** * @details Semaphore which counts the used space in the shared memory array. @@ -68,7 +68,7 @@ static void sig_handler(int signum) * @param void This function takes no parameters. * @return Always non-zero. */ -void usage(void) +static void usage(void) { fprintf(stderr, "SYNOPSIS\n" "\tsupervisor\n"); @@ -81,7 +81,7 @@ void usage(void) * @param void This function takes no parameters. * @return 0 on success, non-zero on failure. */ -void cleanup(void) +static void cleanup(void) { shared->quit = 1; sem_wait(sUsedSpace); @@ -114,7 +114,7 @@ void cleanup(void) * @param void This function takes no parameters. * @return This function has no return value. */ -void initCircBuf(void) +static void initCircBuf(void) { shared->quit = 0; for (int i = 0; i < MAX_ITEMS; i++) { @@ -131,7 +131,7 @@ void initCircBuf(void) * @param sem The semaphore to be decremented. * @return 0 on success, non-zero on failure. */ -void wait_sem(sem_t *sem) +static void wait_sem(sem_t *sem) { while (sem_wait(sem) == -1) { // interrupted by syscall? if (errno == EINTR) { @@ -153,8 +153,8 @@ void wait_sem(sem_t *sem) * @param sUsedSpace Semaphore which counts the used space. * @param sFreeSpace Semaphore which counts the free space. * @return This function has no return value. - */ -void getSolution(sem_t *sUsedSpace, sem_t *sFreeSpace) + */ +static void getSolution(sem_t *sUsedSpace, sem_t *sFreeSpace) { int solution[MAX_ITEMS]; for (int i = 0; i < MAX_ITEMS; i++) {