ReactOS 0.4.15-dev-7711-g5627da4
mem.c File Reference
#include <schily/mconfig.h>
#include <schily/stdio.h>
#include <schily/stdlib.h>
#include <schily/unistd.h>
#include <schily/string.h>
#include <schily/standard.h>
#include <schily/schily.h>
#include <schily/nlsdefs.h>
Include dependency graph for mem.c:

Go to the source code of this file.

Functions

EXPORT int ___mexval __PR ((int exval))
 
EXPORT void *___malloc __PR ((size_t size, char *msg))
 
EXPORT void *___realloc __PR ((void *ptr, size_t size, char *msg))
 
EXPORT char *___savestr __PR ((const char *s))
 
EXPORT int ___mexval (int exval)
 
EXPORT void___malloc (size_t size, char *msg)
 
EXPORT void___realloc (void *ptr, size_t size, char *msg)
 
EXPORT char___savestr (char *s) const
 

Variables

static UConst char sccsid []
 
LOCAL int mexval
 

Function Documentation

◆ ___malloc()

EXPORT void * ___malloc ( size_t  size,
char msg 
)

Definition at line 53 of file mem.c.

56{
57 void *ret;
58
59 ret = malloc(size);
60 if (ret == NULL) {
61 int err = geterrno();
62
63 errmsg(gettext("Cannot allocate memory for %s.\n"), msg);
64 if (mexval)
65 err = mexval;
66 comexit(err);
67 /* NOTREACHED */
68 }
69 return (ret);
70}
#define msg(x)
Definition: auth_time.c:54
EXPORT void comexit(int err)
Definition: comerr.c:331
EXPORT int errmsg(char *msg, va_alist)
Definition: comerr.c:192
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
EXPORT int geterrno()
Definition: geterrno.c:34
GLsizeiptr size
Definition: glext.h:5919
#define gettext(s)
Definition: nlsdefs.h:71
#define err(...)
LOCAL int mexval
Definition: mem.c:39
int ret

◆ ___mexval()

EXPORT int ___mexval ( int  exval)

Definition at line 42 of file mem.c.

44{
45 int ret = mexval;
46
47 mexval = exval;
48
49 return (ret);
50}

◆ ___realloc()

EXPORT void * ___realloc ( void ptr,
size_t  size,
char msg 
)

Definition at line 73 of file mem.c.

77{
78 void *ret;
79
80 if (ptr == NULL)
81 ret = malloc(size);
82 else
83 ret = realloc(ptr, size);
84 if (ret == NULL) {
85 int err = geterrno();
86
87 errmsg(gettext("Cannot realloc memory for %s.\n"), msg);
88 if (mexval)
89 err = mexval;
90 comexit(err);
91 /* NOTREACHED */
92 }
93 return (ret);
94}
#define realloc
Definition: debug_ros.c:6
static PVOID ptr
Definition: dispmode.c:27

◆ ___savestr()

EXPORT char * ___savestr ( char s) const

Definition at line 97 of file mem.c.

99{
100 char *ret = ___malloc(strlen(s)+1, "saved string");
101
102 strcpy(ret, s);
103 return (ret);
104}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLdouble s
Definition: gl.h:2039
#define ___malloc
Definition: schily.h:630

◆ __PR() [1/4]

EXPORT char *___savestr __PR ( (const char *s )

◆ __PR() [2/4]

EXPORT int ___mexval __PR ( (int exval)  )

◆ __PR() [3/4]

EXPORT void *___malloc __PR ( (size_t size, char *msg )

◆ __PR() [4/4]

Variable Documentation

◆ mexval

LOCAL int mexval

Definition at line 39 of file mem.c.

Referenced by ___malloc(), ___mexval(), and ___realloc().

◆ sccsid

UConst char sccsid[]
static
Initial value:
=
"@(#)mem.c 1.11 15/05/10 Copyright 1998-2015 J. Schilling"

Definition at line 4 of file mem.c.