Commit 8a4a9d98 authored by Chris's avatar Chris
Browse files

explicitly setting (void) in function declaration

parent 3cab7827
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
#include <string.h>
#include "menu.h"

enum MENU_DIRECTION get_direction();
MENU_DIRECTION get_direction(void);

char *menu_prompt(const menu_item *items, const unsigned int num_menu_items) {
    for (int i = 0; i < num_menu_items; i++) {
@@ -31,7 +31,7 @@ char *menu_prompt(const menu_item *items, const unsigned int num_menu_items) {
            }
        }

        enum MENU_DIRECTION direction = get_direction();
        MENU_DIRECTION direction = get_direction();

        switch (direction) {
            case DOWN:
@@ -62,7 +62,7 @@ char *menu_prompt(const menu_item *items, const unsigned int num_menu_items) {
    return selected_action;
}

enum MENU_DIRECTION get_direction() {
MENU_DIRECTION get_direction(void) {
    // todo test (+ fix) all of this character grabbing stuff in windows - use conio.h as included above
    char key_pressed = (char) getchar(); // with terminal set to raw mode, this will no longer wait for Enter key; note that Enter key is handled with \n case

+3 −3
Original line number Diff line number Diff line
@@ -5,12 +5,12 @@
#ifndef MENU_H
#define MENU_H

enum MENU_DIRECTION {
typedef enum {
    DOWN,
    UP,
    SELECT,
    NONE,
};
} MENU_DIRECTION;

typedef struct {
    char *title;
@@ -18,6 +18,6 @@ typedef struct {
} menu_item;

char *menu_prompt(const menu_item *items, unsigned int num_menu_items);
enum MENU_DIRECTION get_menu_direction(int selection);
MENU_DIRECTION get_menu_direction(int selection);

#endif //MENU_H