From 76aa27a1265d7f6ea4133dd435f05f7f6374d950 Mon Sep 17 00:00:00 2001 From: Max Holleman Date: Fri, 4 Aug 2023 09:53:37 +0200 Subject: [PATCH] Reworked some headers, make project buildable. --- src/CMakeLists.txt | 1 + src/exp_list.c | 4 ++-- src/include/CMakeLists.txt | 1 - src/{include/cexp.h => list.h} | 12 +++--------- 4 files changed, 6 insertions(+), 12 deletions(-) rename src/{include/cexp.h => list.h} (55%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a0e8c8..ecc273d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ add_executable(netex + "list.h" "main.c" "exp_list.c") target_include_directories(netex PRIVATE ${CMAKE_SOURCE_DIR}/src/include) diff --git a/src/exp_list.c b/src/exp_list.c index eba5a7d..c9260fc 100644 --- a/src/exp_list.c +++ b/src/exp_list.c @@ -1,6 +1,6 @@ #include "stdlib.h" #include "string.h" -#include "cexp.h" +#include "list.h" #include "netex.h" #define INCREMENT_SIZE 5 @@ -16,7 +16,7 @@ static struct exp_data* list = NULL; void list_add(char* name, char* command, int (*exp_func) (void*)) { if (alloc_list() != 0) - { TRACE_ERROR("Unable to allocate memory!"); return; } + { ERROR("Unable to allocate memory!"); return; } list[list_index_count].name = name; list[list_index_count].command = command; list[list_index_count].func_ptr = exp_func; diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt index 0dcc7e9..37513b7 100644 --- a/src/include/CMakeLists.txt +++ b/src/include/CMakeLists.txt @@ -1,5 +1,4 @@ target_sources(netex PUBLIC "net.h" "netex.h" - "cexp.h" "sockets.h") diff --git a/src/include/cexp.h b/src/list.h similarity index 55% rename from src/include/cexp.h rename to src/list.h index 7afb45c..fa1cd30 100644 --- a/src/include/cexp.h +++ b/src/list.h @@ -1,5 +1,5 @@ -#ifndef CEXP_H -#define CEXP_H +#ifndef LIST_H +#define LIST_H #include #include @@ -15,10 +15,4 @@ void print_list_items(); struct exp_data* get_command(char* command); struct exp_data* get_from_list(int index); void clear_list(); - -// Tracing -#define PRINT_LINE(msg, args...) fprintf(stdout, msg "\n", ##args) -#define TRACE_WARN(msg, args...) fprintf(stdout, "[Warning]: " msg "\n", ##args) -#define TRACE_ERROR(msg, args...) fprintf(stderr, "[ERROR]: " msg "\n", ##args) - -#endif +#endif \ No newline at end of file