---
name: "libwget-xalloc"
section: "3"
platform: "linux"
package: "wget2-dev"
version: "2.2.0+ds-1+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/libwget-xalloc"
---

# libwget-xalloc(3)

Memory allocation functions

## NAME

libwget-xalloc - Memory allocation functions

## SYNOPSIS

### Variables

**wget\_malloc\_function** \* **wget\_malloc\_fn** = malloc\
 **wget\_calloc\_function** \* **wget\_calloc\_fn** = calloc\
 **wget\_realloc\_function** \* **wget\_realloc\_fn** = realloc\
 **wget\_free\_function** \* **wget\_free** = free\
 WGETAPI **wget\_malloc\_function** \* **wget\_malloc\_fn**\
 WGETAPI **wget\_calloc\_function** \* **wget\_calloc\_fn**\
 WGETAPI **wget\_realloc\_function** \* **wget\_realloc\_fn**\
 WGETAPI **wget\_free\_function** \* **wget\_free**\
 RETURNS\_NONNULL LIBWGET\_WARN\_UNUSED\_RESULT size\_t **size**\
 \#define **wget\_xfree**(a)   do { if (a) { wget\_free((void \*)(a)); a=NULL; } } while (0)\
 typedef void \* **wget\_malloc\_function**(size\_t)\
 Type of malloc() function.  typedef void \* **wget\_calloc\_function**(size\_t, size\_t)\
 Type of calloc() function.  typedef void \* **wget\_realloc\_function**(void \*, size\_t)\
 Type of realloc() function.  typedef void **wget\_free\_function**(void \*)\
 Type of free() function.  RETURNS\_NONNULL LIBWGET\_WARN\_UNUSED\_RESULT **WGET\_GCC\_ALLOC\_SIZE** (1) WGET\_GCC\_MALLOC static inline void \*NULLABLE wget\_malloc(size\_t size)\
 RETURNS\_NONNULL LIBWGET\_WARN\_UNUSED\_RESULT **WGET\_GCC\_ALLOC\_SIZE2** (1, 2) WGET\_GCC\_MALLOC static inline void \*NULLABLE wget\_calloc(size\_t nmemb\
 RETURNS\_NONNULL LIBWGET\_WARN\_UNUSED\_RESULT **WGET\_GCC\_ALLOC\_SIZE** (2) static inline void \*NULLABLE wget\_realloc(void \*ptr\

## Detailed Description

Global function pointers to memory allocation functions and to free().

These pointers can be set to custom functions.

## Macro Definition Documentation

### #define wget\_xfree(a) do { if (a) { wget\_free((void \*)(a)); a=NULL; } } while (0)

Memory allocation function pointers

## Variable Documentation

### RETURNS\_NONNULL LIBWGET\_WARN\_UNUSED\_RESULT size\_t size

**Initial value:**.PP

```
{
    return wget_calloc_fn(nmemb, size)
```

## Author

Generated automatically by Doxygen for wget2 from the source code.
