JabberWerxC
2015.1.1
|
Basic defines, macros, and global functions for JabberWerxC. More...
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | jw_err |
Macros | |
#define | JABBERWERX_API |
#define | UNUSED_PARAM(p) ((void)&(p)) |
#define | __attribute__(x) |
#define | PRAGMA(x) _Pragma(#x) |
#define | GCC_BEGIN_IGNORED_WARNING(x) |
#define | GCC_END_IGNORED_WARNING(x) |
#define | BASE10_WIDTH2(s) sizeof(#s) |
#define | BASE10_WIDTH(s) BASE10_WIDTH2(s) |
#define | UINT64_MAX_WIDTH BASE10_WIDTH(UINT64_MAX) |
#define | UINT32_MAX_WIDTH BASE10_WIDTH(UINT32_MAX) |
#define | JABBERWERX_ERROR(err, errcode) |
Functions | |
JABBERWERX_API const char * | jw_err_message (jw_errcode code) |
JABBERWERX_API const char * | jw_version (bool full) |
JABBERWERX_API bool | jw_global_init (jw_err *err) |
JABBERWERX_API void | jw_global_cleanup () |
Basic defines, macros, and global functions for JabberWerxC.
Copyrights
Portions created or assigned to Cisco Systems, Inc. are Copyright (c) 2010-2015 Cisco Systems, Inc. All Rights Reserved. See LICENSE for details.
#define __attribute__ | ( | x | ) |
Hide GCC attribute definitions from non-GCC compilers
#define BASE10_WIDTH | ( | s | ) | BASE10_WIDTH2(s) |
Dereferences a symbol so its value can be stringified
#define BASE10_WIDTH2 | ( | s | ) | sizeof(#s) |
Calculates the length of a stringified symbol value, including the terminating NULL.
#define GCC_BEGIN_IGNORED_WARNING | ( | x | ) |
This is a noop for non-gcc compilers
#define GCC_END_IGNORED_WARNING | ( | x | ) |
This is a noop for non-gcc compilers
#define JABBERWERX_API |
Marks a symbol as part of the public API.
#define JABBERWERX_ERROR | ( | err, | |
errcode | |||
) |
Macro to initialize an error context.
err | The pointer to the error context, or NULL if none |
errcode | The error code |
#define PRAGMA | ( | x | ) | _Pragma(#x) |
Compiler pragma helper.
Insert a C99 compiler pragma based on an unterminated string. This allows for pragmas to be generated dynamically.
#define UINT32_MAX_WIDTH BASE10_WIDTH(UINT32_MAX) |
The size of a buffer large enough to hold a base 10 string version of the largest unsigned 32-bit value
#define UINT64_MAX_WIDTH BASE10_WIDTH(UINT64_MAX) |
The size of a buffer large enough to hold a base 10 string version of the largest unsigned 64-bit value
#define UNUSED_PARAM | ( | p | ) | ((void)&(p)) |
A macro for quelling compiler warnings about unused variables.
enum jw_errcode |
Enumeration of defined error codes.
JABBERWERX_API const char* jw_err_message | ( | jw_errcode | code | ) |
Retrieves the error message for the given error code.
code | The error code to lookup |
const | char * The message for {code} |
JABBERWERX_API void jw_global_cleanup | ( | ) |
Performs global cleanup of the JabberWerxC library and all used 3rd party libraries. This function can be called regardless of whether jw_global_init() was ever called. If this function is not called, valgrind may report memory leaks.
JABBERWERX_API bool jw_global_init | ( | jw_err * | err | ) |
Performs global initialization of the JabberWerxC library and sets the 3rd party libraries to use JWC memory allocator functions. It is currently not required to call this function or its cleanup counterpart, but eventually the proper functioning of JWC will depend on them. This function may be called multiple times, but will only have an effect the first time it is called or the first time it is called after jw_global_cleanup() is called.
This function can generate the following errors (set when returning false):
JW_ERR_NO_MEMORY
if library stat could not be allocated.[out] | err | The error information (provide NULL to ignore). |
bool | true if the library was initialized successfully. |
JABBERWERX_API const char* jw_version | ( | bool | full | ) |
Retrieves the (runtime) version string of this library. This function can be called without first calling jw_global_init().
full | true to return the full version (with build number), false to return the common version (without build number) |
const | char * The version string. |