ReactOS  0.4.15-dev-1397-g19779b3
compat_str.c File Reference
#include "compat.h"
#include "debug.h"
Include dependency graph for compat_str.c:

Go to the source code of this file.

Functions

voidsafe_realloc (void *ptr, size_t size)
 
const charstrerror (int errnum)
 
charcompat_strdup (const char *src)
 

Function Documentation

◆ compat_strdup()

char* compat_strdup ( const char src)

Definition at line 32 of file compat_str.c.

33 {
34  char *dest = NULL;
35  if(src)
36  {
37  size_t len;
38  len = strlen(src)+1;
39  if((dest = malloc(len)))
40  memcpy(dest, src, len);
41  }
42  return dest;
43 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define NULL
Definition: types.h:112
#define malloc
Definition: debug_ros.c:4
static char * dest
Definition: rtl.c:135

◆ safe_realloc()

void* safe_realloc ( void ptr,
size_t  size 
)

Definition at line 16 of file compat_str.c.

17 {
18  if(ptr == NULL) return malloc(size);
19  else return realloc(ptr, size);
20 }
#define realloc
Definition: debug_ros.c:6
static PVOID ptr
Definition: dispmode.c:27
GLsizeiptr size
Definition: glext.h:5919
#define NULL
Definition: types.h:112
#define malloc
Definition: debug_ros.c:4

◆ strerror()

const char* strerror ( int  errnum)

Definition at line 23 of file compat_str.c.

24 {
25  extern int sys_nerr;
26  extern char *sys_errlist[];
27 
28  return (errnum < sys_nerr) ? sys_errlist[errnum] : "";
29 }
int sys_nerr
char * sys_errlist[]