![]() |
![]() |
![]() |
libuser Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
errorerror — Functions for allocating and manipulating lu_error structures. |
#include <libuser/error.h> struct lu_error; typedef lu_error_t; #define LU_ERROR_CHECK (err_p_p) void lu_error_new (struct lu_error **error
,enum lu_status code
,const char *fmt
,...
); void lu_error_free (struct lu_error **error
); gboolean lu_error_is_success (enum lu_status status
); gboolean lu_error_is_warning (enum lu_status status
); gboolean lu_error_is_error (enum lu_status status
); const char * lu_strerror (struct lu_error *error
);
error.h
includes declarations for allocating and
manipulating lu_error structures. These structures hold error and status
information passed between libuser, its modules, and applications.
A struct lu_error contains an error code and a human-readable, possibly
translated error string. The error string uses the encoding specified by
the LC_CTYPE
locale category.
typedef struct lu_error lu_error_t;
lu_error_t
has been deprecated since version 0.57.3 and should not be used in newly-written code. Use struct lu_error directly.
An alias for struct lu_error.
#define LU_ERROR_CHECK(err_p_p)
Checks that the given pointer to a pointer to a struct does not already
point to a valid lu_error structure, and calls abort()
on failure. This
macro is used by many internal functions to check that an error has not
already occurred when they are invoked.
|
A pointer to a struct lu_error * which will be checked. |
void lu_error_new (struct lu_error **error
,enum lu_status code
,const char *fmt
,...
);
Creates a new lu_error structure.
void lu_error_free (struct lu_error **error
);
Frees an lu_error structure.
|
A pointer to a pointer to the structure to be freed. The pointer is
set to NULL after the error is freed. |
gboolean lu_error_is_success (enum lu_status status
);
Check if the error code held by an error structure is a success code.
|
An error code |
Returns : |
a gboolean indicating whether or not the error is a success code. |
gboolean lu_error_is_warning (enum lu_status status
);
Check if the error code held by an error structure is a warning code.
|
An error code |
Returns : |
a gboolean indicating whether or not the error is a warning code. |
gboolean lu_error_is_error (enum lu_status status
);
Check if the error code held by an error structure is an error code.
|
An error code |
Returns : |
a gboolean indicating whether or not the error is an error code. |