My Project  debian-1:4.1.1-p2+ds-4build2
Macros | Functions
omalloc.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "omalloc.h"

Go to the source code of this file.

Macros

#define OMALLOC_C
 
#define OM_MARK_AS_STATIC(addr)   do {} while (0)
 

Functions

void * malloc (size_t size)
 
void freeSize (void *addr, size_t size)
 
void * reallocSize (void *old_addr, size_t old_size, size_t new_size)
 

Macro Definition Documentation

◆ OM_MARK_AS_STATIC

#define OM_MARK_AS_STATIC (   addr)    do {} while (0)

Definition at line 20 of file omalloc.c.

◆ OMALLOC_C

#define OMALLOC_C

Definition at line 13 of file omalloc.c.

Function Documentation

◆ freeSize()

void freeSize ( void *  addr,
size_t  size 
)

Definition at line 102 of file omalloc.c.

103 {
104  if (addr) omFreeSize(addr, size);
105 }

◆ malloc()

void* malloc ( size_t  size)

Definition at line 92 of file omalloc.c.

93 {
94  void* addr;
95  if (size == 0) size = 1;
96 
97  omTypeAllocAligned(void*, addr, size);
98  OM_MARK_AS_STATIC(addr);
99  return addr;
100 }

◆ reallocSize()

void* reallocSize ( void *  old_addr,
size_t  old_size,
size_t  new_size 
)

Definition at line 107 of file omalloc.c.

108 {
109  if (old_addr && new_size)
110  {
111  void* new_addr;
112  omTypeReallocAlignedSize(old_addr, old_size, void*, new_addr, new_size);
113  OM_MARK_AS_STATIC(new_addr);
114  return new_addr;
115  }
116  else
117  {
118  freeSize(old_addr, old_size);
119  return malloc(new_size);
120  }
121 }
omTypeReallocAlignedSize
#define omTypeReallocAlignedSize
Definition: omAllocDecl.h:276
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
malloc
void * malloc(size_t size)
Definition: omalloc.c:92
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
freeSize
void freeSize(void *addr, size_t size)
Definition: omalloc.c:102
OM_MARK_AS_STATIC
#define OM_MARK_AS_STATIC(addr)
Definition: omalloc.c:20
omTypeAllocAligned
#define omTypeAllocAligned
Definition: omAllocDecl.h:271