ReactOS  0.4.14-dev-384-g5b37caa
rosmem.c File Reference
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/mem.h"
Include dependency graph for rosmem.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 7 of file rosmem.c.

Function Documentation

◆ calloc()

void* calloc ( mem_size_t  count,
mem_size_t  size 
)

Definition at line 17 of file rosmem.c.

18 {
19  void *mem = malloc(count * size);
20 
21  if (!mem) return NULL;
22 
24 
25  return mem;
26 }
void * malloc(mem_size_t size)
Definition: rosmem.c:11
GLuint GLuint GLsizei count
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
Definition: mem.c:156
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

◆ free()

void free ( void mem)

Definition at line 29 of file rosmem.c.

30 {
32 }
#define LWIP_TAG
Definition: rosmem.c:7
Definition: mem.c:156
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by realloc().

◆ malloc()

void* malloc ( mem_size_t  size)

Definition at line 11 of file rosmem.c.

12 {
14 }
GLsizeiptr size
Definition: glext.h:5919
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define LWIP_TAG
Definition: rosmem.c:7

Referenced by calloc(), and realloc().

◆ realloc()

void* realloc ( void mem,
size_t  size 
)

Definition at line 36 of file rosmem.c.

37 {
38  void* new_mem;
39 
40  /* realloc() with a NULL mem pointer acts like a call to malloc() */
41  if (mem == NULL) {
42  return malloc(size);
43  }
44 
45  /* realloc() with a size 0 acts like a call to free() */
46  if (size == 0) {
47  free(mem);
48  return NULL;
49  }
50 
51  /* Allocate the new buffer first */
52  new_mem = malloc(size);
53  if (new_mem == NULL) {
54  /* The old buffer is still intact */
55  return NULL;
56  }
57 
58  /* Copy the data over */
59  RtlCopyMemory(new_mem, mem, size);
60 
61  /* Deallocate the old buffer */
62  free(mem);
63 
64  /* Return the newly allocated block */
65  return new_mem;
66 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
void * malloc(mem_size_t size)
Definition: rosmem.c:11
void free(void *mem)
Definition: rosmem.c:29
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
Definition: mem.c:156