diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-31 06:19:28 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-31 06:19:28 +0200 |
commit | 01c8a8d3c1f621c56a704308037ee1b013e2eb7e (patch) | |
tree | dbbb949066c93ae9f000aa5c95cb85d13463fee2 /src/libgamma-error.h | |
parent | info: doc libgamma_name_of_error and libgamma_value_of_error (diff) | |
download | libgamma-01c8a8d3c1f621c56a704308037ee1b013e2eb7e.tar.gz libgamma-01c8a8d3c1f621c56a704308037ee1b013e2eb7e.tar.bz2 libgamma-01c8a8d3c1f621c56a704308037ee1b013e2eb7e.tar.xz |
add libgamma_perror
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libgamma-error.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/libgamma-error.h b/src/libgamma-error.h index fac5276..44ecec4 100644 --- a/src/libgamma-error.h +++ b/src/libgamma-error.h @@ -289,7 +289,23 @@ extern const char* libgamma_group_name; /** - * Returns the name of the definition associated with a libgamma error code. + * Prints an error to stderr in a `perror` fashion, + * however this function will not translate the `libgamma` + * errors into human-readable strings, it will simply + * print the name of the error. If the value `error_code` + * is the value of `LIBGAMMA_ERRNO_SET`, `perror` will be + * used to print the current error stored in `errno`. + * If `value` is non-negative (a `errno` value`), that + * value will be stored in `errno` and `perror` will be + * used to print it. + * + * @param name The text to add at the beginning. + * @param value The error code, may be an `errno` value. + */ +void libgamma_perror(const char* name, int error_code); + +/** + * Returns the name of the definition associated with a `libgamma` error code. * * @param value The error code. * @return The name of the definition associated with the error code, @@ -299,11 +315,11 @@ extern const char* libgamma_group_name; const char* libgamma_name_of_error(int value) __attribute__((const)); /** - * Return the value of a libgamma error definition refered to by name. + * Return the value of a `libgamma` error definition refered to by name. * * @param name The name of the definition associated with the error code. * @return The error code, zero if the name does is `NULL` - * or does not refer to an libgamma error. + * or does not refer to a `libgamma` error. */ int libgamma_value_of_error(const char* name) __attribute__((const)); |