Commit Graph

20 Commits

Author SHA1 Message Date
Philip Withnall
6162bccf1f
girffi: Fix ffi_cif leaks on error return paths
Spotted by scan-build.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #1767
2024-04-12 18:45:18 +01:00
Philip Withnall
e45c93da79
girffi: Add hints to indicate ownership transfer into ffi_cif
scan-build thinks that the `atypes` array is leaked, but it’s not.
Ownership is transferred into the `ffi_cif` structure, and it’s
eventually freed in `gi_callable_info_destroy_closure()`.

Try and help the static analysis by adding an explicit ownership
transfer annotation. It probably won’t help.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #1767
2024-04-12 18:45:09 +01:00
Philip Withnall
343027d5de girepository: Make GIInfoType private
Eventually, we want to move to using `GType` directly for everything,
since `GIBaseInfo` and its subclasses are all using `GTypeInstance`.

However, that requires quite a lot of changes and we’re about to hit the
API freeze.

So do the smallest set of changes possible to remove `GIInfoType` and
related functions from the public API, which gives us freedom to make
more changes later without breaking API.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2024-02-08 12:56:02 +00:00
Philip Withnall
c8132fdf78 girepository: Rename gi_arg_info_load_type() to gi_arg_info_load_type_info()
So that it matches `gi_arg_info_get_type_info()`. We can’t use
`gi_arg_info_get_type()` because that collides with the `GType` getter
for the type.

Spotted by Philip Chimento.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3243
2024-02-05 15:13:46 +00:00
Philip Withnall
9b5d008f60 girffi: Rename gi_function_invoker_destroy() to …_clear()
This brings its naming more in line with modern GLib conventions.

This is an API break, but libgirepository is not API frozen yet.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-23 22:55:35 +00:00
Philip Withnall
998baf9afb girffi: Expand docs for gi_function_info_prep_invoker()
Mention that the returned `GIFunctionInvoker` needs to be cleared.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-23 18:09:28 +00:00
Philip Withnall
bf4cf2d464 gibaseinfo: Fix use of stack-allocated GIBaseInfos
Most of the code for handling stack-allocated infos was correct, it was
just missing code to initialise the `GTypeInstance` member.

Since `GTypeInstance` isn’t really designed for stack allocation, this
is a little hacky — it requires setting up the member within
`GTypeInstance` manually. It works, though.

The externally visible consequence of this, though, is that
stack-allocated `GIBaseInfo`s now need to be cleared when they’re
finished being used. This allows the `GTypeClass` ref to be dropped.

All users of the stack-allocated APIs in libgirepository will need to
adapt to this change.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3218
2024-01-23 18:07:17 +00:00
Marco Trevisan (Treviño)
25ae968fc2 girepository: Use expected signed types for iterating
We are using various indexes types, but not always using the correct
sign or size, so let's adapt this to ensure we're consistent with the
values we're comparing with.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
9f33015a25 girrepository: Use standard int sized types instead of g[u]int* 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
eda4bfcf95 girrepository: Use void* instead of gpointer 2024-01-16 18:40:37 +01:00
Marco Trevisan (Treviño)
91fc45ea57 girepository: Replace tabs with spaces in indentation
We don't use tabs anywhere and the mixed setup just makes many editors
to cry. So let's just replace the tabs with 8 spaces.
2024-01-16 17:30:37 +01:00
Marco Trevisan (Treviño)
2ee2088f4a girrepository: Drop trailing new line on GMessages 2024-01-15 21:26:53 +00:00
Philip Withnall
5a56518852 girffi: Fix signedness of argument in internal helper function
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2024-01-05 13:51:32 +00:00
Philip Withnall
372ed18253 girffi: Port documentation to gi-docgen and update
Review and update the documentation, making sure it’s complete,
formatted in gi-docgen format, and has all appropriate GIR annotations
and `Since:` lines.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-12-18 14:14:16 +00:00
Philip Withnall
64ad0ecebc girepository: Rename gi_base_info_get_type() to get_info_type()
This method doesn’t return a `GType`, so when the code gets ported to
`GTypeInstance` in an upcoming commit, that will become quite confusing.

Rename it to `gi_base_info_get_info_type()` instead.

This introduces no functional changes, but it is an API break.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
20fea9515d girepository: Add various missing casts
These aren’t needed at the moment, since all the `TypeInfo` structs in
libgirepository are all aliases for each other.

An upcoming commit will change that, however, so we need to be a little
bit stricter about type safety in advance.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
b32da06a7c girepository: Rename symbols to the GI namespace
Rather than a mix of structs being in `GI` and their methods being in
`g_`.

We’ve chosen not to use the `g_` namespace because a number of the
libgirepository class names are quite generic, so we’d end up with
confusing symbols like `GScopeType` and `GArgument`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-11-08 15:05:20 +00:00
Emmanuele Bassi
ba24fc659d Remove deprecated API
There's no point in releasing a new library with deprecated API.
2023-11-07 23:57:18 +00:00
Philip Withnall
844544f72c girepository: Add SPDX license header to all obvious files
Add the SPDX license runes to all the files which have an obvious
copyright header already. This is a mechanical edit.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 17:10:10 +01:00
Emmanuele Bassi
03d6c16434 Move girepository 2023-10-15 17:56:05 +01:00