ajout de nos fichiers

This commit is contained in:
Aloyse ARNAUD
2024-12-16 02:40:29 +01:00
parent a913fd240b
commit 6606b1f872
28 changed files with 13188 additions and 0 deletions

29
Anna et Vincent/alloc.c Normal file
View File

@@ -0,0 +1,29 @@
/**
* @file alloc.c
* @brief Fonctions d'allocation mémoire.
*/
#include "alloc.h"
void multiple_free(void *p, ...) {
va_list ap;
va_start(ap, p);
while (p != NULL) {
free(p);
p = va_arg(ap, void *);
}
va_end(ap);
}
void check_null(const char *function, char *file, int line, int n, ...) {
va_list ap;
char *s;
va_start(ap, n);
for (int i = 0; i < n; i++) {
void *p = va_arg(ap, void *);
s = va_arg(ap, char *);
if (p == NULL)
PRINT_ERROR(KO, "CRITICAL", function, file, line, "%s is NULL.", s);
}
}