Corewar documentation 1.0.0
Loading...
Searching...
No Matches
mymemory.h
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2024
3** Libmymemory
4** File description:
5** The header file of the libmymemory
6*/
13#include "mylist.h"
14
15#ifndef MYMEMORY_H_
16 #define MYMEMORY_H_
17
18// MACROS :
19
20 // Shortcuts :
21
22 #define CALLOC(elt_count, elt_size) my_calloc(elt_count, elt_size, 1)
23 #define MALLOC(size) my_malloc(size, 1)
24 #define REALLOC(ptr, size) my_realloc(ptr, size, 1)
25
26
27
28// FUNCTIONS PROTOTYPES :
29
41void *my_calloc(size_t element_count, size_t element_size, int type);
42
48void my_free(void);
49
59void *my_malloc(size_t size, int type);
60
68char *my_malloc_strdup(char const *src);
69
77char **my_malloc_strdup_word_array(char **array);
78
87char *my_malloc_strndup(char const *src, int n);
88
98void *my_memchr(const void *memory_block, int searched_char, size_t size);
99
109void *my_memcpy(void *destination, const void *source, size_t size);
110
121int my_memcmp(const void *pointer1, const void *pointer2, size_t size);
122
133void *my_memmove(void *destination, const void *source, size_t size);
134
143void *my_memset(void *pointer, int value, size_t size);
144
155void *my_realloc(void *pointer, size_t size, int type);
156
157#endif /* MYMEMORY_H_ */
char * my_malloc_strndup(char const *src, int n)
Duplicates a string with a defined size with my_malloc.
Definition my_malloc_strndup.c:16
void * my_realloc(void *pointer, size_t size, int type)
Reallocates memory for an array of bytes (size)
Definition my_realloc.c:16
void * my_memmove(void *destination, const void *source, size_t size)
Moves bytes (size) from memory area (source) to memory area (destination)
Definition my_memmove.c:15
void * my_malloc(size_t size, int type)
Allocates memory for an array of bytes (size)
Definition my_malloc.c:16
void my_free(void)
Free allocated memory with my_calloc, my_malloc and my_realloc.
Definition my_free.c:16
void * my_calloc(size_t element_count, size_t element_size, int type)
Allocates memory for an array of elements (element_count) of bytes (element_size) each and initialize...
Definition my_calloc.c:16
char * my_malloc_strdup(char const *src)
Duplicates a string with my_malloc.
Definition my_malloc_strdup.c:15
void * my_memcpy(void *destination, const void *source, size_t size)
Copies bytes (size) from memory area (source) to memory area (destination)
Definition my_memcpy.c:15
char ** my_malloc_strdup_word_array(char **array)
Duplicates a word array (array) with my_malloc.
Definition my_malloc_strdup_word_array.c:15
int my_memcmp(const void *pointer1, const void *pointer2, size_t size)
Compares the first (size) bytes of the two memory areas (pointer1 and pointer2)
Definition my_memcmp.c:16
void * my_memchr(const void *memory_block, int searched_char, size_t size)
Copies bytes (size) from memory area (source) to memory area (destination)
Definition my_memchr.c:16
void * my_memset(void *pointer, int value, size_t size)
Fill bytes (size) of memory area (pointer) with a value (value)
Definition my_memset.c:16
The header file of the libmylist.