Merge branch 'error-tweaks' into 'master'

GError documentation tweaks

See merge request GNOME/glib!1880
This commit is contained in:
Emmanuele Bassi 2021-01-13 13:56:42 +00:00
commit 24db331c30
2 changed files with 11 additions and 5 deletions

View File

@ -340,6 +340,8 @@
* - A `GError*` must be initialized to %NULL before passing its address
* 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
* new #GError to a `GError*` that is non-%NULL, thus overwriting
* 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.
* `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
* done with the G_DEFINE_EXTENDED_ERROR() macro. To create an
* extended #GError type do something like this in the header file:

View File

@ -54,17 +54,19 @@ struct _GError
*
* A convenience macro which defines two functions. First, returning
* the #GQuark for the extended error type @ErrorType; it is called
* `@error_type_quark()`. Second, returning the private data from a
* passed #GError; it is called `@error_type_get_private()`.
* `error_type_quark()`. Second, returning the private data from a
* passed #GError; it is called `error_type_get_private()`.
*
* For this macro to work, a type named `@ErrorTypePrivate` should be
* defined, `@error_type_private_init()`, `@error_type_private_copy()`
* and `@error_type_private_clear()` functions need to be either
* For this macro to work, a type named `ErrorTypePrivate` should be
* defined, `error_type_private_init()`, `error_type_private_copy()`
* and `error_type_private_clear()` functions need to be either
* declared or defined. The functions should be similar to
* #GErrorInitFunc, #GErrorCopyFunc and #GErrorClearFunc,
* respectively, but they should receive the private data type instead
* of #GError.
*
* See [Extended #GError Domains][gerror-extended-domains] for an example.
*
* Since: 2.68
*/
#define G_DEFINE_EXTENDED_ERROR(ErrorType, error_type) \