File tree Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change 1
1
#include <unistd.h>
2
2
3
3
#define PAGE_SIZE ((size_t) sysconf(_SC_PAGESIZE))
4
- #define align8 (x ) (((((x) - 1) >> 2) << 2 )+ 8)
4
+ #define align8 (x ) (x % 8) ? (x + (8 - x % 8)) : x
5
5
6
6
static void * heap_start ;
7
7
Original file line number Diff line number Diff line change 5
5
#include <stdio.h>
6
6
7
7
#define PAGE_SIZE ((size_t) sysconf(_SC_PAGESIZE))
8
- #define align8 (x ) (((((x) - 1) >> 2) << 2) + 8 )
8
+ #define align8 (x ) ((x % 8) ? (x + (8 - x % 8)) : x )
9
9
10
10
typedef struct s_block * t_block ;
11
11
12
12
/**
13
13
* struct s_block - Holds the details of each block
14
14
* @size: size of block
15
15
* @next: pointer to next block
16
- * @free: 1 if block is free else 0
17
- * @data: data stored at the block
18
16
*/
19
17
struct s_block
20
18
{
21
19
size_t size ;
22
- t_block next ;
23
- int free ;
24
- char data [1 ];
20
+ struct s_block * next ;
25
21
};
26
22
27
23
#define BLOCK_SIZE sizeof(struct s_block)
You can’t perform that action at this time.
0 commit comments