---
name: "types.h"
section: "3"
platform: "linux"
package: "brotli"
version: "1.2.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/types.h"
---

# types.h(3)

Common types used in decoder and encoder API.

## NAME

types.h - Common types used in decoder and encoder API.

## SYNOPSIS

### Macros

\#define **BROTLI\_BOOL**   int\
 *A portable* `bool` *replacement.*  #define **BROTLI\_FALSE**   0\
 *Portable* `false` *replacement.*  #define **BROTLI\_TRUE**   1\
 *Portable* `true` *replacement.*  #define **TO\_BROTLI\_BOOL**(X)   (!!(X) ? **BROTLI\_TRUE** : **BROTLI\_FALSE**)\
 `bool` *to* **BROTLI\_BOOL** *conversion macros.*

### Typedefs

typedef void \*(\* **brotli\_alloc\_func**) (void \*opaque, size\_t size)\
 *Allocating function pointer type.*  typedef void(\* **brotli\_free\_func**) (void \*opaque, void \*address)\
 *Deallocating function pointer type.*

## Detailed Description

Common types used in decoder and encoder API.

## Macro Definition Documentation

### #define BROTLI\_BOOL int

A portable `bool` replacement. **BROTLI\_BOOL** is a 'documentation' type: actually it is `int`, but in API it denotes a type, whose only values are **BROTLI\_TRUE** and **BROTLI\_FALSE**.

**BROTLI\_BOOL** values passed to Brotli should either be **BROTLI\_TRUE** or **BROTLI\_FALSE**, or be a result of **TO\_BROTLI\_BOOL** macros.

**BROTLI\_BOOL** values returned by Brotli should not be tested for equality with `true`, `false`, **BROTLI\_TRUE**, **BROTLI\_FALSE**, but rather should be evaluated, for example:

```
if (SomeBrotliFunction(encoder, BROTLI_TRUE) &&
    !OtherBrotliFunction(decoder, BROTLI_FALSE)) {
  bool x = !!YetAnotherBrotliFunction(encoder, TO_BROLTI_BOOL(2 * 2 == 4));
  DoSomething(x);
}
```

### #define BROTLI\_FALSE 0

Portable `false` replacement.

### #define BROTLI\_TRUE 1

Portable `true` replacement.

### #define TO\_BROTLI\_BOOL(X) (!!(X) ? BROTLI\_TRUE : BROTLI\_FALSE)

`bool` to **BROTLI\_BOOL** conversion macros.

## Typedef Documentation

### typedef void\*(\* brotli\_alloc\_func) (void \*opaque, size\_t size)

Allocating function pointer type.

**Parameters:**

*opaque* custom memory manager handle provided by client \
 *size* requested memory region size; can not be `0`

**Returns:**

`0` in the case of failure

a valid pointer to a memory region of at least `size` bytes long otherwise

### typedef void(\* brotli\_free\_func) (void \*opaque, void \*address)

Deallocating function pointer type. This function **SHOULD** do nothing if `address` is `0`.

**Parameters:**

*opaque* custom memory manager handle provided by client \
 *address* memory region pointer returned by **brotli\_alloc\_func**, or `0`

## Author

Generated automatically by Doxygen for Brotli from the source code.
