Loading...
Searching...
No Matches
Optional Functions
APR Utility Functions
Collaboration diagram for Optional Functions:

## Macros

#define | APR_OPTIONAL_FN_TYPE(name)
#define | APR_DECLARE_OPTIONAL_FN(ret, name, args)
#define | APR_REGISTER_OPTIONAL_FN(name)
#define | APR_RETRIEVE_OPTIONAL_FN(name)

## Typedefs

typedef void | apr_opt_fn_t(void)

## Functions

void | apr_dynamic_fn_register (const char *szName, apr_opt_fn_t *pfn)
apr_opt_fn_t * | apr_dynamic_fn_retrieve (const char *szName)

## Detailed Description

Typesafe registration and retrieval of functions that may not be present (i.e. functions exported by optional modules)

## Macro Definition Documentation

## APR_DECLARE_OPTIONAL_FN

#define APR_DECLARE_OPTIONAL_FN | ( |  | ret,
|  |  | name,
|  |  | args )

Value:
typedef ret (APR_OPTIONAL_FN_TYPE(name)) args
APR_OPTIONAL_FN_TYPE
#define APR_OPTIONAL_FN_TYPE(name)
Definition apr_optional.h:42

Declare an optional function.

Parameters

  ret | The return type of the function
  name | The name of the function
  args | The function arguments (including brackets)

## APR_OPTIONAL_FN_TYPE

#define APR_OPTIONAL_FN_TYPE | ( |  | name | ) |

Value:
apr_OFN_##name##_t

The type of an optional function.

Parameters

  name | The name of the function

## APR_REGISTER_OPTIONAL_FN

#define APR_REGISTER_OPTIONAL_FN | ( |  | name | ) |

Value:
do { \
APR_OPTIONAL_FN_TYPE(name) *apu__opt = name; \
apr_dynamic_fn_register(#name,(apr_opt_fn_t *)apu__opt); \
} while (0)
apr_opt_fn_t
void apr_opt_fn_t(void)
Definition apr_optional.h:59

Register an optional function. This can be later retrieved, type-safely, by name. Like all global functions, the name must be unique. Note that, confusingly but correctly, the function itself can be static!

Parameters

  name | The name of the function

## APR_RETRIEVE_OPTIONAL_FN

#define APR_RETRIEVE_OPTIONAL_FN | ( |  | name | ) |

Value:
(APR_OPTIONAL_FN_TYPE(name) *)apr_dynamic_fn_retrieve(#name)

Retrieve an optional function. Returns NULL if the function is not present.

Parameters

  name | The name of the function

## Typedef Documentation

## apr_opt_fn_t

typedef void apr_opt_fn_t(void)

XXX: This doesn't belong here, then! Private function! DO NOT USE!