Add static to each function to limit visibility

This commit is contained in:
zenon 2018-06-09 12:59:21 +02:00
parent 3f975a0721
commit 61d457dfc8

View File

@ -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++) {