Skip to content

Commit

Permalink
refactor(LaplaceLib): improve lib_two_free, lib_two_print and add an …
Browse files Browse the repository at this point in the history
…fast flag in Libs's makefile
  • Loading branch information
MasterLaplace committed Oct 17, 2023
1 parent c8b4500 commit 6f01aed
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Libs/LaplaceError/include/laplace_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#ifndef LERROR_H_
#define LERROR_H_
#define LIB_LERROR_VERSION "1.0.0"
#define LIB_LERROR_VERSION "0.0.1"

#include <stdbool.h>
#include <stdio.h>
Expand Down
5 changes: 1 addition & 4 deletions Libs/LaplaceLib/lib_two_free.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ inline void laplace_lib_two_free(char **tab)
{
if (!tab)
return;
for (unsigned i = 0; tab[i]; ++i) {
free(tab[i]);
tab[i] = NULL;
}
for (unsigned i = 0; tab[i]; free(tab[i]), ++i);
free(tab);
tab = NULL;
}
3 changes: 1 addition & 2 deletions Libs/LaplaceLib/lib_two_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ inline void laplace_lib_two_print(const char *tab[])
{
if (!tab)
return;
for (; *tab; ++tab)
printf("%s\n", *tab);
for (; *tab; printf("%s\n", *tab), ++tab);
}
2 changes: 1 addition & 1 deletion Libs/LaplaceLink/include/laplace_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extern link_t *laplace_link_get_at_index(link_t *list, unsigned index);
extern link_t *laplace_link_get_at_obj(link_t *list, void *obj);

#ifdef __cplusplus
}
} // extern "C"
#endif

#endif/* !LAPLACE_LINK_H_ */
1 change: 1 addition & 0 deletions Libs/LaplaceLink/link_remove.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
** EPITECH PROJECT, 2023
** Title: Laplace Link Library v1.0.0
** Author: MasterLaplace
** Created: 2023-10-13
Expand Down
2 changes: 1 addition & 1 deletion Libs/LaplaceMap/include/laplace_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ extern bool laplace_map_cmp_ptr(void *a, void *b);
extern bool laplace_map_cmp_bool(void *a, void *b);

#ifdef __cplusplus
}
} // extern "C"
#endif

#endif/* !LAPLACE_MAP_H_ */
10 changes: 5 additions & 5 deletions Libs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ OBJ_LLIB = $(SRC_LLIB:.c=.o)

OBJ_TEST = $(SRC_TEST:.c=.o)

INCLUDE_LERROR = -I LaplaceError/include
INCLUDE_LLINK = -I LaplaceLink/include
INCLUDE_LMAP = -I LaplaceMap/include
INCLUDE_LLIB = -I LaplaceLib/include
INCLUDE_LERROR = -iquote LaplaceError/include
INCLUDE_LLINK = -iquote LaplaceLink/include
INCLUDE_LMAP = -iquote LaplaceMap/include
INCLUDE_LLIB = -iquote LaplaceLib/include

ifeq ($(OS), linux)
CC = gcc
Expand Down Expand Up @@ -56,7 +56,7 @@ endif

CFLAGS = -Wall -Werror -Wpedantic $(INCLUDE_LLIB) $(INCLUDE_LLINK) $(INCLUDE_LMAP) $(INCLUDE_LERROR)
LDFLAGS = -L. -lLaplaceLib -lLaplaceLink -lLaplaceMap -lLaplaceError
FASTFLAGS = -Ofast -march=native -flto -fomit-frame-pointer \
FASTFLAGS = -Ofast -march=native -mtune=native -flto -fomit-frame-pointer \
-fopenmp -fprefetch-loop-arrays -pipe

all: $(NAME_LLIB) $(NAME_LLINK) $(NAME_LMAP) $(NAME_LERROR)
Expand Down
4 changes: 2 additions & 2 deletions Libs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ The Laplace Map Library is distributed under the MIT License, making it accessib

```shell
# Build
$ cp ../.env .env
$ make re
$ cd ..
$ make lib
```

<div id='contacts'/>
Expand Down
2 changes: 1 addition & 1 deletion Libs/VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LaplaceError v1.0.0
LaplaceError v0.0.1
LaplaceLink v1.0.0
LaplaceMap v1.0.0
LaplaceLib v1.0.0

0 comments on commit 6f01aed

Please sign in to comment.