]> git.notmuchmail.org Git - notmuch/commit - lib/index.cc
index: explicitly follow GObject conventions
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sun, 7 Oct 2018 01:37:57 +0000 (21:37 -0400)
committerDavid Bremner <david@tethera.net>
Sun, 21 Oct 2018 13:21:26 +0000 (10:21 -0300)
commitf5411574afd34d580e3c1256c4f0807974099fcf
tree53a115a2b607889245c3b3eb7f9fc26a7a491bc6
parent64bfe544fd695e30d030e0bf25daf4435c070fb2
index: explicitly follow GObject conventions

Use explicit labels for GTypeInfo member initializers, rather than
relying on comments and ordering.  This is both easier to read, and
harder to screw up.  This also makes it clear that we're mis-casting
GObject class initializers for gcc.

Without this patch, g++ 8.2.0-7 produces this warning:

CXX  -g -O2 lib/index.o
lib/index.cc: In function ‘GMimeFilter* notmuch_filter_discard_non_term_new(GMimeContentType*)’:
lib/index.cc:252:23: warning: cast between incompatible function types from ‘void (*)(NotmuchFilterDiscardNonTermClass*)’ {aka ‘void (*)(_NotmuchFilterDiscardNonTermClass*)’} to ‘GClassInitFunc’ {aka ‘void (*)(void*, void*)’} [-Wcast-function-type]
      (GClassInitFunc) notmuch_filter_discard_non_term_class_init,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The definition of GClassInitFunc in
/usr/include/glib-2.0/gobject/gtype.h suggests that this function will
always be called with the class_data member of the GTypeInfo.  We set
that value to NULL in both GObject definitions in notmuch. So we mark
it as explicitly unused.

There is no functional change here, just code cleanup.
gmime-filter-reply.c
lib/index.cc