-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhalde.h
62 lines (51 loc) · 1.84 KB
/
halde.h
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
#ifndef HALDE_H
#define HALDE_H
#include <sys/types.h>
/*
malloc() allocates size bytes and returns a pointer to the
allocated memory. The memory is not cleared.
RETURN VALUE: The value returned is a pointer
to the allocated memory or NULL if the request fails. The
errno will be set to indicate the error.
*/
void *malloc(size_t size);
/*
free() frees the memory space pointed to by ptr, which
must have been returned by a previous call to malloc(),
calloc() or realloc(). Otherwise, or if free(ptr) has
already been called before the program is aborted.
If ptr is NULL, no operation is performed.
RETURN VALUE: no value
*/
void free(void *ptr);
/*
realloc() changes the size of the memory block pointed to
by ptr to size bytes. The contents will be unchanged to
the minimum of the old and new sizes; newly allocated mem-
ory will be uninitialized. If ptr is NULL, the call is
equivalent to malloc(size). Unless ptr is NULL, it must
have been returned by an earlier call to malloc(),
calloc() or realloc().
RETURN VALUE: The value returned is a pointer
to the allocated memory or NULL if the request fails. The
errno will be set to indicate the error.
*/
void *realloc(void *ptr, size_t size);
/*
calloc() allocates memory for an array of nmemb elements
of size bytes each and returns a pointer to the allocated
memory. The memory is set to zero.
RETURN VALUE: The value returned is a pointer
to the allocated memory or NULL if the request fails. The
errno will be set to indicate the error.
*/
void *calloc(size_t nmemb, size_t size);
/*
* printList is a non-standard function which prints the internal state of the
* free list.
*
* This function can be used to debug the implementation and compare the
* behavior with other implementations.
*/
void printList(void);
#endif