ReactOS 0.4.15-dev-7842-g558ab78
memory.c File Reference
#include <lwip/mem.h>
Include dependency graph for memory.c:

Go to the source code of this file.

Macros

#define LWIP_TAG   'PIwl'
 

Functions

voidmalloc (mem_size_t size)
 
voidcalloc (mem_size_t count, mem_size_t size)
 
void free (void *mem)
 
voidrealloc (void *mem, size_t size)
 

Macro Definition Documentation

◆ LWIP_TAG

#define LWIP_TAG   'PIwl'

Definition at line 4 of file memory.c.

Function Documentation

◆ calloc()

void * calloc ( mem_size_t  count,
mem_size_t  size 
)

Definition at line 14 of file memory.c.

15{
16 void *mem = malloc(count * size);
17
18 if (!mem) return NULL;
19
21
22 return mem;
23}
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
Definition: mem.c:156
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ free()

void free ( void mem)

Definition at line 26 of file memory.c.

27{
29}
#define LWIP_TAG
Definition: memory.c:4
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109

◆ malloc()

void * malloc ( mem_size_t  size)

Definition at line 8 of file memory.c.

9{
11}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307

◆ realloc()

void * realloc ( void mem,
size_t  size 
)

Definition at line 33 of file memory.c.

34{
35 void* new_mem;
36
37 /* realloc() with a NULL mem pointer acts like a call to malloc() */
38 if (mem == NULL) {
39 return malloc(size);
40 }
41
42 /* realloc() with a size 0 acts like a call to free() */
43 if (size == 0) {
44 free(mem);
45 return NULL;
46 }
47
48 /* Allocate the new buffer first */
49 new_mem = malloc(size);
50 if (new_mem == NULL) {
51 /* The old buffer is still intact */
52 return NULL;
53 }
54
55 /* Copy the data over */
56 RtlCopyMemory(new_mem, mem, size);
57
58 /* Deallocate the old buffer */
59 free(mem);
60
61 /* Return the newly allocated block */
62 return new_mem;
63}
#define free
Definition: debug_ros.c:5
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263