From 18c70b580587ab68bf4c3a96723fa3c3e175370e Mon Sep 17 00:00:00 2001 From: mazuh Date: Tue, 14 Nov 2023 16:48:39 -0300 Subject: [PATCH] valgrind --- .github/workflows/clang.yml | 6 +++++- Makefile | 8 +++++++- src/hashtables.c | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index b445fcb..26cec2c 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -12,5 +12,9 @@ jobs: steps: - uses: actions/checkout@v3 + + - name: Install Valgrind + run: sudo apt-get install valgrind -y + - name: Make - run: cc -v && make + run: gcc --version && make valgrind diff --git a/Makefile b/Makefile index 92126fa..cb2ff22 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,9 @@ SRC= $(SRC_FOLDER)/$(SRC_MAIN) BIN_FOLDER = ./build BIN = $(BIN_FOLDER)/hashtables.bin +DEBUG_BIN = $(BIN_FOLDER)/hashtables-debug.bin -.PHONY=default build run clean +.PHONY=default build run clean valgrind default: clean run @@ -21,3 +22,8 @@ run: build clean: rm -rf $(BIN_FOLDER) + +valgrind: + mkdir -p $(BIN_FOLDER) + gcc $(SRC) -Wall -pedantic -g -ggdb -O0 -std=c18 -o $(DEBUG_BIN) + valgrind $(DEBUG_BIN) diff --git a/src/hashtables.c b/src/hashtables.c index 9a23146..714aab4 100644 --- a/src/hashtables.c +++ b/src/hashtables.c @@ -22,7 +22,7 @@ unsigned long hash_str_djb2(char *raw_string) } return hash_value; -}; +} /** * @brief Internal data structure, each bucket is a row in the hash table powering the HashStrSet.