Skip to content

Commit a1c3a18

Browse files
author
Guillaume Pouyat
committed
[MASTER] Norme: 42
1 parent bf2c234 commit a1c3a18

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

sources/free.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: gpouyat <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2018/09/26 20:19:26 by gpouyat #+# #+# */
9-
/* Updated: 2018/10/03 14:43:10 by gpouyat ### ########.fr */
9+
/* Updated: 2018/10/08 11:47:32 by gpouyat ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -20,7 +20,6 @@ void free(void *ptr)
2020

2121
if (!ptr)
2222
return ;
23-
2423
malloc_pthread_lock(g_malloc.mutex);
2524
if ((zone = is_valid_addr(ptr)))
2625
{

sources/intern/defrag.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: gpouyat <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2018/09/26 16:36:30 by gpouyat #+# #+# */
9-
/* Updated: 2018/10/03 12:13:52 by gpouyat ### ########.fr */
9+
/* Updated: 2018/10/08 11:48:42 by gpouyat ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -43,12 +43,12 @@ void defrag_next(t_block *b)
4343
last = b;
4444
if (!b)
4545
return ;
46-
while(last->next && last->next->free)
46+
while (last->next && last->next->free)
4747
last = last->next;
4848
if (last == b)
4949
return ;
5050
b->size = last - b + BLOCK_SIZE;
5151
b->next = last->next;
5252
if (last->next)
5353
last->next->previous = b;
54-
}
54+
}

sources/malloc.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
/* By: gpouyat <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2018/09/26 18:56:29 by gpouyat #+# #+# */
9-
/* Updated: 2018/10/03 14:43:05 by gpouyat ### ########.fr */
9+
/* Updated: 2018/10/08 11:47:44 by gpouyat ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

1313
#include "../includes/intern_malloc.h"
1414

15-
// extern t_malloc_global g_malloc;
16-
1715
t_malloc_global g_malloc = {
1816
NULL,
1917
NULL,

sources/realloc.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: gpouyat <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2018/09/27 11:30:22 by gpouyat #+# #+# */
9-
/* Updated: 2018/10/03 14:51:06 by gpouyat ### ########.fr */
9+
/* Updated: 2018/10/08 11:47:58 by gpouyat ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -25,16 +25,12 @@ void *realloc(void *ptr, size_t size)
2525
zone = is_valid_addr(ptr);
2626
malloc_pthread_unlock(g_malloc.mutex);
2727
if (!zone)
28-
{
2928
return (NULL);
30-
}
3129
malloc_pthread_lock(g_malloc.mutex);
3230
block = resize_block(get_block(ptr), ft_align(size, 16));
3331
malloc_pthread_unlock(g_malloc.mutex);
3432
if (block)
35-
{
3633
return (get_data(block));
37-
}
3834
if ((block = malloc(size)))
3935
{
4036
malloc_pthread_lock(g_malloc.mutex);

0 commit comments

Comments
 (0)