|
The m17n Library 1.8.20
|
Error handling of the m17n library. More...
Enumerations | |
| enum | MErrorCode |
| Enumeration for error code of the m17n library. More... | |
Variables | |
| int | merror_code |
| External variable holding the error code of the m17n library. | |
| void(*) | m17n_memory_full_handler (enum MErrorCode err) |
| Memory allocation error handler. | |
Error handling of the m17n library.
There are two types of errors that may happen in a function of the m17n library.
The first type is argument errors. When a library function is called with invalid arguments, it returns a value that indicates error and at the same time sets the external variable merror_code to a non-zero integer.
The second type is memory allocation errors. When the required amount of memory is not available on the system, m17n library functions call a function pointed to by the external variable m17n_memory_full_handler. The default value of the variable is a pointer to the default_error_handle() function, which just calls exit().
| enum MErrorCode |
Enumeration for error code of the m17n library.
When a library function is called with an invalid argument, it sets the external variable merror_code to one of these values. All the error codes are positive integers.
When a memory allocation error happens, the function pointed to by the external variable m17n_memory_full_handler is called with one of these values as an argument.
| int merror_code |
External variable holding the error code of the m17n library.
The external variable merror_code stores an error code reported by the m17n library. When a library function is called with an invalid argument, or when an internal library error occurs, such as an initialization failure, this variable is set to one of the values defined in enum MErrorCode.
This variable is initially set to MERROR_NONE (i.e. 0).
| void(*) m17n_memory_full_handler(enum MErrorCode err) | ( | enum MErrorCode | err | ) |
Memory allocation error handler.
The external variable m17n_memory_full_handler holds a pointer to the function to call when a library function failed to allocate memory. err is one of enum MErrorCode indicating in which function the error occurred.
This variable initially points a function that simply calls the exit () function with err as an argument.
An application program that needs a different error handling can change this variable to point a proper function.