Skip to content

Further changes to modernise the code base#3

Open
ebassi wants to merge 14 commits into
shaunix:masterfrom
ebassi:ebassi-next
Open

Further changes to modernise the code base#3
ebassi wants to merge 14 commits into
shaunix:masterfrom
ebassi:ebassi-next

Conversation

@ebassi
Copy link
Copy Markdown
Contributor

@ebassi ebassi commented Jun 1, 2015

This is the last round of changes to make Axing use the current best practices for GObject:

  • instance private data via pointer arithmetic instead of dereference
  • macro-ified headers to cut down the boilerplate
  • moderately adequate compiler warnings (could be improved)

I also ended up removing some dead code.

In theory we could do with a pass of g_auto, g_autoptr, and g_autofree to reduce the code in the error handling cases. There's also the port from GSimpleAsyncResult to GTask, but those are two large, non-mechanical refactorings.

ebassi added 14 commits June 1, 2015 12:49
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.
@shaunix shaunix self-assigned this Jun 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants