-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_alloc_mem.c
68 lines (59 loc) · 1.18 KB
/
show_alloc_mem.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
** show_alloc_mem.c for in /u/all/brenne_t/cu/rendu/c/malloc
**
** Made by thomas brennetot
** Login <[email protected]>
**
** Started on Wed Mar 25 16:29:30 2009 thomas brennetot
** Last update Sat Mar 28 17:35:32 2009 thomas brennetot
*/
#include "pointh.h"
void my_putstr(char *str)
{
write(1, str, strlen(str));
}
void my_putchar(char c)
{
write(1, &c, 1);
}
void my_put_nbr(int nb)
{
if (nb < 0)
{
my_putchar('-');
my_put_nbr(-nb);
}
else
{
if (nb < 10)
my_putchar(nb + '0');
else
{
my_put_nbr(nb / 10);
my_putchar((nb % 10) + '0');
}
}
return ;
}
void show_alloc_mem()
{
t_malloc *st_malloc;
int i = 1;
st_malloc = gl_malloc;
while (st_malloc != NULL)
{
my_putstr("size_ask\t");
my_put_nbr(st_malloc->size_ask);
my_putstr("\tsize_block\t");
my_put_nbr(st_malloc->size_block);
my_putstr("\tsize avec header\t");
my_put_nbr(st_malloc->size_block + sizeof(*st_malloc));
my_putstr("\tlocation\t");
my_put_nbr((int)st_malloc);
my_putstr("\tnb\t");
my_put_nbr(i++);
my_putstr("\n");
st_malloc = st_malloc->next;
}
my_putstr("\n\n");
}