types.h(3) Library Functions Manual types.h(3)

# [NAME](#NAME)

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

# [SYNOPSIS](#SYNOPSIS)

## [Macros](#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](#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](#Detailed_Description)

Common types used in decoder and encoder API.

# [Macro Definition Documentation](#Macro_Definition_Documentation)

## [#define BROTLI\_BOOL int](#_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](#_define_BROTLI_FALSE___0)

Portable false **replacement.**

## [#define BROTLI\_TRUE 1](#_define_BROTLI_TRUE___1)

Portable true **replacement.**

## [#define TO\_BROTLI\_BOOL(X) (!!(X) ? **BROTLI\_TRUE** : **BROTLI\_FALSE**)](#_define_TO_BROTLI_BOOL%28X%29___%28!!%28X%29_?_)

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

# [Typedef Documentation](#Typedef_Documentation)

## [typedef void\*(* brotli\_alloc\_func) (void \*opaque, size\_t size)](#typedef_void*%28*_brotli_alloc_func%29_%28void_*opaque,_size_t_size%29)

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)](#typedef_void%28*_brotli_free_func%29_%28void_*opaque,_void_*address%29)

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](#Author)

Generated automatically by Doxygen for Brotli from the source code.

August 2021 Brotli

---

Document: types.h(3) from brotli 1.2.0-r5 (Chainguard OS)
Source: https://github.com/google/brotli.git
