MPD: util/Alloc.hxx File Reference

MPD 0.20.18

Functions
Alloc.hxx File Reference
`#include "Compiler.h"`
`#include <stddef.h>`
Include dependency graph for Alloc.hxx:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions
gcc_malloc void * | xalloc (size_t size)
| Allocate memory. More...
gcc_malloc gcc_nonnull_all void * | xmemdup (const void *s, size_t size)
| Duplicate memory. More...
gcc_malloc gcc_nonnull_all char * | xstrdup (const char *s)
| Duplicate a string. More...
gcc_malloc gcc_nonnull_all char * | xstrndup (const char *s, size_t n)
| Duplicate a string. More...
gcc_malloc gcc_nonnull_all char * | xstrcatdup (const char *a, const char *b)
| Concatenate two strings, returning a new allocation. More...
gcc_malloc gcc_nonnull_all char * | xstrcatdup (const char *a, const char *b, const char *c)
gcc_malloc gcc_nonnull_all char * | xstrcatdup (const char *a, const char *b, const char *c, const char *d)

## Function Documentation

## ◆ xalloc()

gcc_malloc void* xalloc | ( | size_t | size | ) |

Allocate memory.

Use free() to free it.

This function never fails; in out-of-memory situations, it aborts the process.

## ◆ xmemdup()

gcc_malloc gcc_nonnull_all void* xmemdup | ( | const void * | s,
|  | size_t | size
| ) |  |

Duplicate memory.

Use free() to free it.

This function never fails; in out-of-memory situations, it aborts the process.

## ◆ xstrcatdup() [1/3]

gcc_malloc gcc_nonnull_all char* xstrcatdup | ( | const char * | a,
|  | const char * | b
| ) |  |

Concatenate two strings, returning a new allocation.

Use free() to free it.

This function never fails; in out-of-memory situations, it aborts the process.

## ◆ xstrcatdup() [2/3]

gcc_malloc gcc_nonnull_all char* xstrcatdup | ( | const char * | a,
|  | const char * | b,
|  | const char * | c
| ) |  |

## ◆ xstrcatdup() [3/3]

gcc_malloc gcc_nonnull_all char* xstrcatdup | ( | const char * | a,
|  | const char * | b,
|  | const char * | c,
|  | const char * | d
| ) |  |

## ◆ xstrdup()

gcc_malloc gcc_nonnull_all char* xstrdup | ( | const char * | s | ) |

Duplicate a string.

Use free() to free it.

This function never fails; in out-of-memory situations, it aborts the process.

## ◆ xstrndup()

gcc_malloc gcc_nonnull_all char* xstrndup | ( | const char * | s,
|  | size_t | n
| ) |  |

Duplicate a string.

Use free() to free it.

This function never fails; in out-of-memory situations, it aborts the process.