mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 02:36:19 +01:00
Merge branch 'error-tweaks' into 'master'
GError documentation tweaks See merge request GNOME/glib!1880
This commit is contained in:
commit
24db331c30
@ -340,6 +340,8 @@
|
|||||||
* - A `GError*` must be initialized to %NULL before passing its address
|
* - A `GError*` must be initialized to %NULL before passing its address
|
||||||
* to a function that can report errors.
|
* to a function that can report errors.
|
||||||
*
|
*
|
||||||
|
* - #GError structs must not be stack-allocated.
|
||||||
|
*
|
||||||
* - "Piling up" errors is always a bug. That is, if you assign a
|
* - "Piling up" errors is always a bug. That is, if you assign a
|
||||||
* new #GError to a `GError*` that is non-%NULL, thus overwriting
|
* new #GError to a `GError*` that is non-%NULL, thus overwriting
|
||||||
* the previous error, it indicates that you should have aborted
|
* the previous error, it indicates that you should have aborted
|
||||||
@ -373,6 +375,8 @@
|
|||||||
* location is either %NULL or contains a %NULL error (e.g.
|
* location is either %NULL or contains a %NULL error (e.g.
|
||||||
* `g_return_if_fail (error == NULL || *error == NULL);`).
|
* `g_return_if_fail (error == NULL || *error == NULL);`).
|
||||||
*
|
*
|
||||||
|
* ## Extended #GError Domains # {#gerror-extended-domains}
|
||||||
|
*
|
||||||
* Since GLib 2.68 it is possible to extend the #GError type. This is
|
* Since GLib 2.68 it is possible to extend the #GError type. This is
|
||||||
* done with the G_DEFINE_EXTENDED_ERROR() macro. To create an
|
* done with the G_DEFINE_EXTENDED_ERROR() macro. To create an
|
||||||
* extended #GError type do something like this in the header file:
|
* extended #GError type do something like this in the header file:
|
||||||
|
@ -54,17 +54,19 @@ struct _GError
|
|||||||
*
|
*
|
||||||
* A convenience macro which defines two functions. First, returning
|
* A convenience macro which defines two functions. First, returning
|
||||||
* the #GQuark for the extended error type @ErrorType; it is called
|
* the #GQuark for the extended error type @ErrorType; it is called
|
||||||
* `@error_type_quark()`. Second, returning the private data from a
|
* `error_type_quark()`. Second, returning the private data from a
|
||||||
* passed #GError; it is called `@error_type_get_private()`.
|
* passed #GError; it is called `error_type_get_private()`.
|
||||||
*
|
*
|
||||||
* For this macro to work, a type named `@ErrorTypePrivate` should be
|
* For this macro to work, a type named `ErrorTypePrivate` should be
|
||||||
* defined, `@error_type_private_init()`, `@error_type_private_copy()`
|
* defined, `error_type_private_init()`, `error_type_private_copy()`
|
||||||
* and `@error_type_private_clear()` functions need to be either
|
* and `error_type_private_clear()` functions need to be either
|
||||||
* declared or defined. The functions should be similar to
|
* declared or defined. The functions should be similar to
|
||||||
* #GErrorInitFunc, #GErrorCopyFunc and #GErrorClearFunc,
|
* #GErrorInitFunc, #GErrorCopyFunc and #GErrorClearFunc,
|
||||||
* respectively, but they should receive the private data type instead
|
* respectively, but they should receive the private data type instead
|
||||||
* of #GError.
|
* of #GError.
|
||||||
*
|
*
|
||||||
|
* See [Extended #GError Domains][gerror-extended-domains] for an example.
|
||||||
|
*
|
||||||
* Since: 2.68
|
* Since: 2.68
|
||||||
*/
|
*/
|
||||||
#define G_DEFINE_EXTENDED_ERROR(ErrorType, error_type) \
|
#define G_DEFINE_EXTENDED_ERROR(ErrorType, error_type) \
|
||||||
|
Loading…
Reference in New Issue
Block a user