Further changes to modernise the code base#3
Open
ebassi wants to merge 14 commits into
Open
Conversation
Use the new instance private data macros and functions, and remove the pointer from the instance structure.
Removes a bunch of boilerplate.
- Use the G_DECLARE_DERIVABLE_TYPE macro.
- Make AxingResolver an abstract type, to avoid instantiation through
g_object_new().
- Make the singleton getter thread safe.
Make SimpleResolver a 'final' type; this is more in line with GIO, and makes the code simpler.
Makes the AxingStream class abstract, in line with GIO.
Calls 'run-tests' for us.
In order to use G_DECLARE_* macro we need to remove the `priv` pointer
from the instance structure; this means that we need to retrieve the
instance private data when needed.
This is mostly a mechanical replacement of every instance of:
context->parser->priv->some_field
With the functionally equivalent of:
AxingXmlParserPrivate *priv =
axing_xml_parser_get_instance_private (context->parser);
priv->some_field
While it's a bit longer, it is more readable and it reduces the amount
of pointer dereferencing quite a bit.
Cut down the amount of error handling code by using this new, awesome, I-can't-believe-it's-not-C++™ feature of GCC and CLang.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the last round of changes to make Axing use the current best practices for GObject:
I also ended up removing some dead code.
In theory we could do with a pass of
g_auto,g_autoptr, andg_autofreeto reduce the code in the error handling cases. There's also the port fromGSimpleAsyncResulttoGTask, but those are two large, non-mechanical refactorings.