Skip to content

Commit b952a60

Browse files
author
Guillaume Pouyat
committed
[Master] Correction: prepare for correction
1 parent 947a3d4 commit b952a60

File tree

13 files changed

+22
-187
lines changed

13 files changed

+22
-187
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# By: gpouyat <[email protected]> +#+ +:+ +#+ #
77
# +#+#+#+#+#+ +#+ #
88
# Created: 2017/02/05 12:29:27 by gpouyat #+# #+# #
9-
# Updated: 2018/09/27 14:30:06 by gpouyat ### ########.fr #
9+
# Updated: 2018/10/02 11:39:02 by gpouyat ### ########.fr #
1010
# #
1111
# **************************************************************************** #
1212

correction/prepare.py

-28
This file was deleted.

correction/run.sh

-13
This file was deleted.

correction/sources/test0.c

-14
This file was deleted.

correction/sources/test1.c

-16
This file was deleted.

correction/sources/test2.c

-17
This file was deleted.

correction/sources/test3++.c

-26
This file was deleted.

correction/sources/test3.c

-24
This file was deleted.

correction/sources/test4.c

-19
This file was deleted.

correction/sources/test5.c

-12
This file was deleted.

includes/intern_malloc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: gpouyat <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2018/09/26 12:26:26 by gpouyat #+# #+# */
9-
/* Updated: 2018/09/27 16:19:23 by gpouyat ### ########.fr */
9+
/* Updated: 2018/10/02 11:51:26 by gpouyat ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

main.c

+18-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
#include "./includes/ft_malloc.h"
1+
/* ************************************************************************** */
2+
/* */
3+
/* ::: :::::::: */
4+
/* main.c :+: :+: :+: */
5+
/* +:+ +:+ +:+ */
6+
/* By: gpouyat <[email protected]> +#+ +:+ +#+ */
7+
/* +#+#+#+#+#+ +#+ */
8+
/* Created: 2018/10/02 12:00:56 by gpouyat #+# #+# */
9+
/* Updated: 2018/10/02 12:02:02 by gpouyat ### ########.fr */
10+
/* */
11+
/* ************************************************************************** */
212

3-
// extern t_malloc_global g_malloc;
13+
#include "./includes/ft_malloc.h"
414

5-
// void print_one(t_block *block)
6-
// {
7-
// if (block)
8-
// printf("size = %lu, next = %lx, free = %d\n", block->size, (long)block->next, block->free);
9-
// else
10-
// printf("NO blocks\n");
11-
// }
12-
#include <assert.h>
13-
int main()
15+
int main(void)
1416
{
15-
char *toto = malloc(42);
16-
toto = NULL;
17+
char *toto;
18+
1719
toto = malloc(42);
18-
}
20+
free(toto);
21+
return (0);
22+
}

sources/malloc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: gpouyat <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2018/09/26 18:56:29 by gpouyat #+# #+# */
9-
/* Updated: 2018/09/27 15:58:53 by gpouyat ### ########.fr */
9+
/* Updated: 2018/10/02 11:56:44 by gpouyat ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -20,9 +20,9 @@ void *malloc(size_t size)
2020
size_t s;
2121

2222
ptr_alloc = NULL;
23-
init_zones();
2423
s = ft_align(size, 16);
2524
malloc_pthread_lock(g_malloc.mutex);
25+
init_zones();
2626
if (s <= TINY_MAX)
2727
ptr_alloc = create_alloc(g_malloc.tiny, s);
2828
if (s <= MEDIUM_MAX && ptr_alloc == NULL)

0 commit comments

Comments
 (0)