ekg2
Definicje | Funkcje

Dokumentacja pliku ekg/xmalloc.c

#include "ekg2-config.h"
#include "win32.h"
#include <sys/types.h>
#include <stddef.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include "configfile.h"
#include "stuff.h"
#include "userlist.h"
#include "xmalloc.h"
#include "compat/strndup.h"
#include "compat/strnlen.h"
#include "compat/strfry.h"

Definicje

#define _GNU_SOURCE
#define __EXTENSIONS__
#define fix(s)   ((s) ? (s) : "")

Funkcje

void ekg_oom_handler ()
void * xcalloc (size_t nmemb, size_t size)
void * xmalloc (size_t size)
void xfree (void *ptr)
void * xrealloc (void *ptr, size_t size)
char * xstrdup (const char *s)
size_t xstrnlen (const char *s, size_t n)
char * xstrndup (const char *s, size_t n)
char * utf8ndup (const char *s, size_t n)
void * xmemdup (void *ptr, size_t size)
char * vsaprintf (const char *format, va_list ap)
char * xstrstr (const char *haystack, const char *needle)
char * xstrcasestr (const char *haystack, const char *needle)
int xstrcasecmp (const char *s1, const char *s2)
char * xstrcat (char *dest, const char *src)
char * xstrchr (const char *s, int c)
int xstrcmp (const char *s1, const char *s2)
int xstrcoll (const char *s1, const char *s2)
char * xstrcpy (char *dest, const char *src)
size_t xstrcspn (const char *s, const char *reject)
char * xstrfry (char *string)
size_t xstrlen (const char *s)
int xstrncasecmp_pl (const char *s1, const char *s2, size_t n)
char * xstrncat (char *dest, const char *src, size_t n)
int xstrncmp (const char *s1, const char *s2, size_t n)
char * xstrncpy (char *dest, const char *src, size_t n)
int xstrncasecmp (const char *s1, const char *s2, size_t n)
char * xstrpbrk (const char *s, const char *accept)
char * xstrrchr (const char *s, int c)
size_t xstrspn (const char *s, const char *accept)
char * xstrtok (char *s, const char *delim)
char * xindex (const char *s, int c)
char * xrindex (const char *s, int c)

Dokumentacja definicji

#define __EXTENSIONS__
#define _GNU_SOURCE
#define fix (   s)    ((s) ? (s) : "")

Dokumentacja funkcji

void ekg_oom_handler ( )
char* utf8ndup ( const char *  s,
size_t  n 
)
char* vsaprintf ( const char *  format,
va_list  ap 
)
void* xcalloc ( size_t  nmemb,
size_t  size 
)
void xfree ( void *  ptr)

xfree()

Free memory pointed by ptr if ptr == NULL do nothing.
Equivalent to: if (ptr) free(ptr);

Zobacz również:
xrealloc() - If you want change size of allocated memory.
char* xindex ( const char *  s,
int  c 
)
void* xmalloc ( size_t  size)

xmalloc()

Allocate memory for size bytes, clears it [set it with \0], and returns pointer to allocated memory. If malloc() fails with NULL, ekg_oom_handler() kills program.
Wrapper to malloc()+memset()

Błąd:
Possible bug: Some libc may return NULL if size is 0, from man malloc:
If size is 0 (...) a null pointer (...) shall be returned.
XXX, check it in configure.ac if malloc() returns NULL on 0 size, and check here if size is 0.
Zobacz również:
xcalloc()
xfree()
Parametry:
size- the same as in malloc()
Zwraca:
pointer to allocated memory
void* xmemdup ( void *  ptr,
size_t  size 
)
void* xrealloc ( void *  ptr,
size_t  size 
)
char* xrindex ( const char *  s,
int  c 
)
int xstrcasecmp ( const char *  s1,
const char *  s2 
)
char* xstrcasestr ( const char *  haystack,
const char *  needle 
)
char* xstrcat ( char *  dest,
const char *  src 
)
char* xstrchr ( const char *  s,
int  c 
)
int xstrcmp ( const char *  s1,
const char *  s2 
)
int xstrcoll ( const char *  s1,
const char *  s2 
)
char* xstrcpy ( char *  dest,
const char *  src 
)
size_t xstrcspn ( const char *  s,
const char *  reject 
)
char* xstrdup ( const char *  s)
char* xstrfry ( char *  string)
size_t xstrlen ( const char *  s)
int xstrncasecmp ( const char *  s1,
const char *  s2,
size_t  n 
)
int xstrncasecmp_pl ( const char *  s1,
const char *  s2,
size_t  n 
)
char* xstrncat ( char *  dest,
const char *  src,
size_t  n 
)
int xstrncmp ( const char *  s1,
const char *  s2,
size_t  n 
)
char* xstrncpy ( char *  dest,
const char *  src,
size_t  n 
)
char* xstrndup ( const char *  s,
size_t  n 
)
size_t xstrnlen ( const char *  s,
size_t  n 
)
char* xstrpbrk ( const char *  s,
const char *  accept 
)
char* xstrrchr ( const char *  s,
int  c 
)
size_t xstrspn ( const char *  s,
const char *  accept 
)
char* xstrstr ( const char *  haystack,
const char *  needle 
)
char* xstrtok ( char *  s,
const char *  delim 
)
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje