Skip to content

Commit

Permalink
Revert "Add void keyword to functions that take no arguments"
Browse files Browse the repository at this point in the history
This reverts commit 6dbf3fb.
  • Loading branch information
cm-jones committed Apr 23, 2024
1 parent a176d95 commit 53cf5e6
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion include/dsc_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ void dsc_set_error(DSCError error);
*
* @return The last error code.
*/
DSCError dsc_get_error(void);
DSCError dsc_get_error();

#endif // __DSC_ERROR_H__
2 changes: 1 addition & 1 deletion include/dsc_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef struct DSCList DSCList;
* @return A pointer to the newly created list, or NULL if memory allocation
* fails.
*/
struct DSCList *dsc_list_create(void);
struct DSCList *dsc_list_create();

/**
* @brief Destroys the list and frees its memory.
Expand Down
2 changes: 1 addition & 1 deletion include/dsc_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ typedef struct DSCMap DSCMap;
*
* @return A pointer to the newly created map, or NULL if memory allocation fails.
*/
DSCMap *dsc_map_create(void);
DSCMap *dsc_map_create();

/**
* @brief Destroys the map and frees its memory.
Expand Down
2 changes: 1 addition & 1 deletion include/dsc_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct DSCQueue DSCQueue;
*
* @return A pointer to the newly created queue, or NULL if memory allocation fails.
*/
DSCQueue *dsc_queue_create(void);
DSCQueue *dsc_queue_create();

/**
* @brief Destroys the queue and frees its memory.
Expand Down
2 changes: 1 addition & 1 deletion include/dsc_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef struct DSCSet DSCSet;
*
* @return A pointer to the newly created hash set, or NULL if memory allocation fails.
*/
DSCSet *dsc_set_create(void);
DSCSet *dsc_set_create();

/**
* @brief Destroys the hash set and frees its memory.
Expand Down
2 changes: 1 addition & 1 deletion include/dsc_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct DSCStack DSCStack;
*
* @return A pointer to the newly created stack, or NULL if memory allocation fails.
*/
DSCStack *dsc_stack_create(void);
DSCStack *dsc_stack_create();

/**
* @brief Destroys the stack and frees its memory.
Expand Down
2 changes: 1 addition & 1 deletion include/dsc_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct DSCVector DSCVector;
*
* @return A pointer to the newly created vector, or NULL if memory allocation fails.
*/
DSCVector *dsc_vector_create(void);
DSCVector *dsc_vector_create();

/**
* @brief Destroys the vector and frees its memory.
Expand Down
2 changes: 1 addition & 1 deletion src/dsc_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// Global variable to store the last error code
static DSCError last_error = DSC_ERROR_NONE;

DSCError dsc_get_error(void) {
DSCError dsc_get_error() {
return last_error;
}

Expand Down
2 changes: 1 addition & 1 deletion src/dsc_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void dsc_node_destroy(DSCNode *node) {
}
}

DSCList *dsc_list_create(void) {
DSCList *dsc_list_create() {
DSCList *new_list = malloc(sizeof *new_list);
if (new_list == NULL) {
dsc_set_error(DSC_ERROR_OUT_OF_MEMORY);
Expand Down
2 changes: 1 addition & 1 deletion src/dsc_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static bool dsc_queue_resize(DSCQueue *queue, unsigned int new_capacity) {
return true;
}

DSCQueue *dsc_queue_create(void) {
DSCQueue *dsc_queue_create() {
DSCQueue *new_queue = malloc(sizeof *new_queue);
if (new_queue == NULL) {
dsc_set_error(DSC_ERROR_OUT_OF_MEMORY);
Expand Down
2 changes: 1 addition & 1 deletion src/dsc_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void dsc_set_rehash(DSCSet *set, unsigned int new_capacity) {
set->capacity = new_capacity;
}

DSCSet *dsc_set_create(void) {
DSCSet *dsc_set_create() {
DSCSet *new_set = calloc(1, sizeof *new_set);
if (new_set == NULL) {
dsc_set_error(DSC_ERROR_OUT_OF_MEMORY);
Expand Down
2 changes: 1 addition & 1 deletion src/dsc_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static bool dsc_stack_resize(DSCStack *stack, unsigned int new_capacity) {
return true;
}

DSCStack *dsc_stack_create(void) {
DSCStack *dsc_stack_create() {
DSCStack *new_stack = malloc(sizeof *new_stack);
if (new_stack == NULL) {
dsc_set_error(DSC_ERROR_OUT_OF_MEMORY);
Expand Down
2 changes: 1 addition & 1 deletion src/dsc_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static bool dsc_vector_resize(DSCVector *vector, unsigned int new_capacity) {
return true;
}

DSCVector *dsc_vector_create(void) {
DSCVector *dsc_vector_create() {
DSCVector *new_vector = malloc(sizeof *new_vector);
if (new_vector == NULL) {
dsc_set_error(DSC_ERROR_OUT_OF_MEMORY);
Expand Down
20 changes: 10 additions & 10 deletions tests/test_dsc_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ void run_test(void (*test_func)(void), const char *name) {
/* Test cases */

void test_dsc_list_create() {
DSCList *list = dsc_list_create(void);
DSCList *list = dsc_list_create();
assert(list != NULL);
dsc_list_destroy(list);
tests_passed++;
}

void test_dsc_list_push_front(void) {
void test_dsc_list_push_front() {
DSCList *list = dsc_list_create();
dsc_list_push_front(list, 42);
dsc_list_push_front(list, 73);
Expand All @@ -51,7 +51,7 @@ void test_dsc_list_push_front(void) {
tests_passed++;
}

void test_dsc_list_push_back(void) {
void test_dsc_list_push_back() {
DSCList *list = dsc_list_create();
dsc_list_push_back(list, 42);
dsc_list_push_back(list, 73);
Expand All @@ -61,7 +61,7 @@ void test_dsc_list_push_back(void) {
tests_passed++;
}

void test_dsc_list_insert_after(void) {
void test_dsc_list_insert_after() {
DSCList *list = dsc_list_create();
dsc_list_push_front(list, 42);
DSCNode *head = dsc_list_get_head(list);
Expand All @@ -72,7 +72,7 @@ void test_dsc_list_insert_after(void) {
tests_passed++;
}

void test_dsc_list_pop_front(void) {
void test_dsc_list_pop_front() {
DSCList *list = dsc_list_create();
dsc_list_push_front(list, 42);
dsc_list_push_front(list, 73);
Expand All @@ -83,7 +83,7 @@ void test_dsc_list_pop_front(void) {
tests_passed++;
}

void test_dsc_list_remove(void) {
void test_dsc_list_remove() {
DSCList *list = dsc_list_create();
dsc_list_push_front(list, 42);
dsc_list_push_front(list, 73);
Expand All @@ -94,7 +94,7 @@ void test_dsc_list_remove(void) {
tests_passed++;
}

void test_dsc_list_remove_all(void) {
void test_dsc_list_remove_all() {
DSCList *list = dsc_list_create();
dsc_list_push_front(list, 42);
dsc_list_push_front(list, 73);
Expand All @@ -105,15 +105,15 @@ void test_dsc_list_remove_all(void) {
tests_passed++;
}

void test_dsc_list_front(void) {
void test_dsc_list_front() {
DSCList *list = dsc_list_create();
dsc_list_push_front(list, 42);
assert(dsc_list_front(list) == 42);
dsc_list_destroy(list);
tests_passed++;
}

void test_dsc_list_empty(void) {
void test_dsc_list_empty() {
DSCList *list = dsc_list_create();
assert(dsc_list_empty(list));
dsc_list_push_front(list, 42);
Expand All @@ -122,7 +122,7 @@ void test_dsc_list_empty(void) {
tests_passed++;
}

int main(void) {
int main() {
run_test(test_dsc_list_create, "test_dsc_list_create");
run_test(test_dsc_list_push_front, "test_dsc_list_push_front");
run_test(test_dsc_list_push_back, "test_dsc_list_push_back");
Expand Down
20 changes: 10 additions & 10 deletions tests/test_dsc_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ void run_test(void (*test_func)(void), const char *name) {
test_func();
}

void test_dsc_map_create(void) {
void test_dsc_map_create() {
DSCMap *map = dsc_map_create();
assert(map != NULL);
dsc_map_free(map);
tests_passed++;
}

void test_dsc_map_insert(void) {
void test_dsc_map_insert() {
DSCMap *map = dsc_map_create();
int key = 42;
int value = 73;
Expand All @@ -47,7 +47,7 @@ void test_dsc_map_insert(void) {
tests_passed++;
}

void test_dsc_map_insert_duplicate(void) {
void test_dsc_map_insert_duplicate() {
DSCMap *map = dsc_map_create();
int key = 42;
int value1 = 73;
Expand All @@ -59,7 +59,7 @@ void test_dsc_map_insert_duplicate(void) {
tests_passed++;
}

void test_dsc_map_erase(void) {
void test_dsc_map_erase() {
DSCMap *map = dsc_map_create();
int key = 42;
int value = 73;
Expand All @@ -70,15 +70,15 @@ void test_dsc_map_erase(void) {
tests_passed++;
}

void test_dsc_map_erase_nonexistent(void) {
void test_dsc_map_erase_nonexistent() {
DSCMap *map = dsc_map_create();
int key = 42;
assert(dsc_map_erase(map, key) == false);
dsc_map_free(map);
tests_passed++;
}

void test_dsc_map_contains(void) {
void test_dsc_map_contains() {
DSCMap *map = dsc_map_create();
int key = 42;
int value = 73;
Expand All @@ -89,7 +89,7 @@ void test_dsc_map_contains(void) {
tests_passed++;
}

void test_dsc_map_size(void) {
void test_dsc_map_size() {
assert(dsc_map_size(NULL) == -1);
DSCMap *map = dsc_map_create();
assert(dsc_map_size(map) == 0);
Expand All @@ -101,7 +101,7 @@ void test_dsc_map_size(void) {
tests_passed++;
}

void test_dsc_map_empty(void) {
void test_dsc_map_empty() {
DSCMap *map = dsc_map_create();
assert(dsc_map_empty(map) == true);
dsc_map_insert(map, 42, 73);
Expand All @@ -110,7 +110,7 @@ void test_dsc_map_empty(void) {
tests_passed++;
}

void test_dsc_map_clear(void) {
void test_dsc_map_clear() {
DSCMap *map = dsc_map_create();
dsc_map_insert(map, 42, 73);
dsc_map_insert(map, 84, 21);
Expand All @@ -120,7 +120,7 @@ void test_dsc_map_clear(void) {
tests_passed++;
}

int main(void) {
int main() {
run_test(test_dsc_map_create, "test_dsc_map_create");
run_test(test_dsc_map_insert, "test_dsc_map_insert");
run_test(test_dsc_map_insert_duplicate, "test_dsc_map_insert_duplicate");
Expand Down
16 changes: 8 additions & 8 deletions tests/test_dsc_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ void run_test(void (*test_func)(void), const char *name) {
test_func();
}

void test_dsc_queue_create(void) {
void test_dsc_queue_create() {
DSCQueue *queue = dsc_queue_create();
assert(queue != NULL);
dsc_queue_free(queue);
tests_passed++;
}

void test_dsc_queue_push(void) {
void test_dsc_queue_push() {
DSCQueue *queue = dsc_queue_create();
dsc_queue_push(queue, 42);
dsc_queue_push(queue, 73);
Expand All @@ -46,7 +46,7 @@ void test_dsc_queue_push(void) {
tests_passed++;
}

void test_dsc_queue_pop(void) {
void test_dsc_queue_pop() {
DSCQueue *queue = dsc_queue_create();
dsc_queue_push(queue, 42);
dsc_queue_push(queue, 73);
Expand All @@ -56,15 +56,15 @@ void test_dsc_queue_pop(void) {
tests_passed++;
}

void test_dsc_queue_front(void) {
void test_dsc_queue_front() {
DSCQueue *queue = dsc_queue_create();
dsc_queue_push(queue, 42);
assert(dsc_queue_front(queue) == 42);
dsc_queue_free(queue);
tests_passed++;
}

void test_dsc_queue_back(void) {
void test_dsc_queue_back() {
DSCQueue *queue = dsc_queue_create();
dsc_queue_push(queue, 42);
dsc_queue_push(queue, 73);
Expand All @@ -73,7 +73,7 @@ void test_dsc_queue_back(void) {
tests_passed++;
}

void test_dsc_queue_empty(void) {
void test_dsc_queue_empty() {
DSCQueue *queue = dsc_queue_create();
assert(dsc_queue_empty(queue));
dsc_queue_push(queue, 42);
Expand All @@ -82,7 +82,7 @@ void test_dsc_queue_empty(void) {
tests_passed++;
}

void test_dsc_queue_size(void) {
void test_dsc_queue_size() {
DSCQueue *queue = dsc_queue_create();
assert(dsc_queue_size(queue) == 0);
dsc_queue_push(queue, 42);
Expand All @@ -93,7 +93,7 @@ void test_dsc_queue_size(void) {
tests_passed++;
}

int main(void) {
int main() {
run_test(test_dsc_queue_create, "test_dsc_queue_create");
run_test(test_dsc_queue_push, "test_dsc_queue_push");
run_test(test_dsc_queue_pop, "test_dsc_queue_pop");
Expand Down
Loading

0 comments on commit 53cf5e6

Please sign in to comment.