Low-level core library that forms the basis for projects such as GTK+ and GNOME.
Go to file
Emmanuele Bassi 605fdf7046 Add copy and free function annotations for POD types
Plain Old Data (POD) types with or without a representation in the GType
type system can still have a copy and/or a free function. We should
allow annotating these types with their corresponding functions for
copying their data into a new instance, and freeing their data.

From a language bindings perspective, POD types should have a boxed
GType wrapper around them, so they can use the generic GBoxed API to
copy and free instances; from a documentation perspective, though, it'd
be good to have a way to match a structured type, like a struct or a
union, with its copy and free functions.

In order to do that, we add two new header block annotations:

- (copy-func function_name)
- (free-func function_name)

These annotations work exactly like ref-func and unref-func for typed
instances:

    /**
     * GdkRGBA: (copy-func gdk_rgba_copy)
     *   (free-func gdk_rgba_free)
     * @red: ...
     * @green: ...
     * @blue: ...
     * @alpha: ...
     *
     * ...
     */

The function is stored in the GIR data as two new attributes for the
`<record>` and `<union>` elements:

    <record name="RGBA"
            c:type="GdkRGBA"
            copy-function="gdk_rgba_copy"
            free-function="gdk_rgba_free"
            glib:type-name="GdkRGBA"
            glib:get-type="gdk_rgba_get_type"
            c:symbol-prefix="gdk_rgba">

The annotations are not mandatory.

See: #14
2023-01-08 14:50:28 +00:00
cmph Add missing (void) arguments to comply with -Wstrict-prototypes 2022-10-06 04:09:09 +02:00
cmph-bdz-test.c Drop calls to g_type_init() 2012-10-16 10:58:08 -04:00
docs.c docs: Remove everything not related to libgirepository and restructure. Fixes #244 2018-12-14 11:29:11 +01:00
gdump.c Skip default-value for non-transformable properties 2023-01-08 14:20:06 +00:00
gi-dump-types.c meson: also build gi-dump-types on Windows 2020-05-19 19:39:34 +02:00
giarginfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
giarginfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
gibaseinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
gibaseinfo.h Use the proper private triglyph 2022-02-13 14:20:03 +00:00
gicallableinfo.c gi[callable|type]info.c: Avoid MSVC C4098 warnings 2022-03-28 20:11:21 +00:00
gicallableinfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
giconstantinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
giconstantinfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
gienuminfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
gienuminfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
gifieldinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
gifieldinfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
gifunctioninfo.c docs: Remove inaccurate description 2022-08-06 13:52:01 -07:00
gifunctioninfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
giinterfaceinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
giinterfaceinfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
ginvoke.c Initialise argument 2021-06-24 18:17:56 +00:00
giobjectinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
giobjectinfo.h Add "final" class attribute 2021-08-05 16:24:23 +00:00
gipropertyinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
gipropertyinfo.h Add introspection data for property accessors 2021-08-05 17:47:29 +01:00
giregisteredtypeinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
giregisteredtypeinfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
girepository-private.h build: enable -Wredundant-decls 2018-07-29 18:57:03 +02:00
girepository.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
girepository.h girepository: Return pointer array for interface cache 2019-06-20 11:54:10 -07:00
girffi.c Remove runtime warnings, add doxygen deprecation notices 2021-11-23 23:04:26 +00:00
girffi.h Rename argument in the declation 2022-02-13 14:41:48 +00:00
girmodule.c girepository: Use constant time calculation for sections after Object fields 2015-10-10 17:41:24 -04:00
girmodule.h Add Emacs mode lines to C sources 2012-02-03 13:42:56 -05:00
girnode.c Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
girnode.h Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
giroffsets.c docs: fix up reference docs a bit 2013-10-10 16:48:51 -04:00
girparser.c Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
girparser.h Add Emacs mode lines to C sources 2012-02-03 13:42:56 -05:00
girwriter.c Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
girwriter.h Add Emacs mode lines to C sources 2012-02-03 13:42:56 -05:00
gisignalinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
gisignalinfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
gistructinfo.c Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
gistructinfo.h Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
gitypeinfo.c gi[callable|type]info.c: Avoid MSVC C4098 warnings 2022-03-28 20:11:21 +00:00
gitypeinfo.h gitypeinfo: Add pointer-stuffing functions for GITypeTag storage type 2022-02-16 17:58:24 -08:00
gitypelib-internal.h Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
gitypelib.c Use GI_TYPE_TAG_IS_BASIC 2022-02-13 14:35:53 +00:00
gitypelib.h docs: Remove everything not related to libgirepository and restructure. Fixes #244 2018-12-14 11:29:11 +01:00
gitypes.h Use GI_TYPE_TAG_IS_BASIC 2022-02-13 14:35:53 +00:00
giunioninfo.c Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
giunioninfo.h Add copy and free function annotations for POD types 2023-01-08 14:50:28 +00:00
giversion.c girepository: Add version macros and functions. Fixes #200 2018-12-16 12:51:58 +01:00
giversion.h.in girepository: Add version macros and functions. Fixes #200 2018-12-16 12:51:58 +01:00
giversionmacros.h Open g-i 1.75 development 2023-01-08 14:47:58 +00:00
givfuncinfo.c docs: Remove DocBook tags 2022-02-13 14:20:51 +00:00
givfuncinfo.h girepository: Add Header for Version Macros 2014-08-15 09:45:41 +08:00
gthash-test.c Drop calls to g_type_init() 2012-10-16 10:58:08 -04:00
gthash.c build: enable -Wtype-limits 2018-07-29 18:57:03 +02:00
meson.build Make test suite work with cross-related options 2021-05-23 12:56:21 -04:00