Commit Graph

101 Commits

Author SHA1 Message Date
Tor Lillqvist
e5e4f8bca3 gtype.h Revert my change from 2008-07-24. No G_TYPE_FORMAT is needed. Just
2008-07-27  Tor Lillqvist  <tml@novell.com>

	* gtype.h
	* gtype.c: Revert my change from 2008-07-24. No G_TYPE_FORMAT is
	needed. Just use G_GSIZE_FORMAT always when printing GType values.


svn path=/trunk/; revision=7256
2008-07-27 15:58:48 +00:00
Tor Lillqvist
b46641eab2 Define G_TYPE_FORMAT as the printf format for a GType value. Either
2008-07-24  Tor Lillqvist  <tml@novell.com>

	* gtype.h: Define G_TYPE_FORMAT as the printf format for a GType
	value. Either G_GSIZE_FORMAT or "lu".

	* gtype.c: Use it instead of the C99 zu.


svn path=/trunk/; revision=7250
2008-07-24 01:11:52 +00:00
Matthias Clasen
d6d221911d Fix up section comments
svn path=/trunk/; revision=7137
2008-07-02 03:43:13 +00:00
Michael Natterer
6347be5fb6 remove trailing whitespace from newly added gtk-doc comments and
2008-06-22  Michael Natterer  <mitch@imendio.com>

	* *.c: remove trailing whitespace from newly added gtk-doc
	comments and reformatted some where they contained overly long or
	ill-formatted lines.


svn path=/trunk/; revision=7090
2008-06-22 14:53:09 +00:00
Michael Natterer
5602b7e275 moved includes back to the top of the files (before gtk-doc SECTION
2008-06-22  Michael Natterer  <mitch@imendio.com>

	* *.c: moved includes back to the top of the files (before gtk-doc
	SECTION comments). Add "config.h" in all files and move system
	included before glib includes. Remove trailing whitespace from
	SECTION comments and did some reformatting where lines were overly
	long, no documentation content was changed.


svn path=/trunk/; revision=7089
2008-06-22 14:29:25 +00:00
Stefan Kost
ac94781e28 Move some content for gobject-unused.sgml and cleared empty entries. The
* docs/reference/gobject/tmpl/gobject-unused.sgml:
	* gobject/gobject.h:
	* gobject/gtype.c:
	* gobject/gtype.h:
	  Move some content for gobject-unused.sgml and cleared empty entries.
	  The remaining 4 ones should be checked by some else. If they are not
	  needed. The file can be removed.


svn path=/trunk/; revision=7087
2008-06-22 10:10:59 +00:00
Stefan Kost
005be9980a Migrating docs.
* docs/reference/gobject/tmpl/gtype.sgml:
	* gobject/gtype.c:
	* gobject/gtype.h:
	* gobject/gvaluetypes.h:
	  Migrating docs.


svn path=/trunk/; revision=7075
2008-06-21 16:14:18 +00:00
Tim Janik
0e1960fd6e g_type_class_ref() comment fixes.
svn path=/trunk/; revision=6985
2008-06-10 11:41:34 +00:00
13:15:29 Tim Janik
e9f756f17e fixed race condition where references to partially initialized classes
2008-06-10 13:15:29  Tim Janik  <timj@imendio.com>

        * gtype.c (g_type_class_ref): fixed race condition where references to
        partially initialized classes could be handed out.


svn path=/trunk/; revision=6982
2008-06-10 11:26:50 +00:00
18:52:07 Tim Janik
0dd27821f2 added recursive mutex to protect class initialization, default interface
2008-02-05 18:52:07  Tim Janik  <timj@imendio.com>

        * gtype.c: added recursive mutex to protect class initialization,
        default interface initialization and per-class interface construction.
        a lock to this recursive mutex is held during user callback invocations
        such as initializers or finalizers, effectively allowing only one thread
        to run class/interface initializers/finalizers at a time.
        also made misc fixups. this fixes:
        Bug 64764 - Class initialization isn't thread safe.



svn path=/trunk/; revision=6454
2008-02-05 17:52:52 +00:00
Cody Russell
19086497ab Check for 0-sized private data. (#443869)
2007-06-14  Cody Russell  <bratsche@gnome.org>

        * gobject/gtype.c (g_type_class_add_private): Check for 0-sized
        private data. (#443869)


svn path=/trunk/; revision=5561
2007-06-15 03:50:27 +00:00
Matthias Clasen
0eb82133c5 Fri Dec 15 2006 Matthias Clasen <mclasen@redhat.com>
* gtype.c (instance_real_class_get): Dereference the pointer
        before dropping the lock.  (#378078, Jonathan Matthew)
2006-12-16 04:28:43 +00:00
Matthias Clasen
20b39ffafa Fix some issues with PLT entries. 2006-09-30 13:59:01 +00:00
Matthias Clasen
dd106106dc Separate groups by an empty line (#344868, Christian Persch)
2006-06-14  Matthias Clasen  <mclasen@redhat.com>

	* glib/gkeyfile.c (g_key_file_to_data): Separate groups by
	an empty line  (#344868, Christian Persch)

2006-06-14  Tor Lillqvist  <tml@novell.com>
2006-06-15 19:18:51 +00:00
Matthias Clasen
68eaeb69cb Fix some problems with my last commit 2006-04-23 04:21:08 +00:00
Matthias Clasen
2e57b11a94 Add g_type_register_static_simple 2006-04-21 16:53:02 +00:00
Tim Janik
d871f19c30 use g_slic_* for all object allocations.
Thu Dec  1 12:53:26 2005  Tim Janik  <timj@imendio.com>

        * gtype.c: use g_slic_* for all object allocations.
2005-12-01 16:33:51 +00:00
Tim Janik
0cba1b531d prepared deprecation of GMemChunk and GAllocator. added g_slice_*() API to
Tue Nov  1 16:24:20 2005  Tim Janik  <timj@imendio.com>

        * glib/gmem.[hc]: prepared deprecation of GMemChunk and GAllocator.
        added g_slice_*() API to allocate and cache small bits of memory.
        an actuall allocator implementation for g_slice_*() is still pending.

        * glib/gthread.[hc]: changes from a patch by Matthias Clasen.
        changed GRealThread list to use in-structure *next; fields instead
        of GSList, in order for thread iteration to not depenend on g_slice_*()
        indirectly.
        _g_thread_mem_private_get():
        _g_thread_mem_private_set(): added accessors for private memory,
        needed because the ordinary GPrivate implementation relies on GArray
        and GSList and therefore indirectly on working g_slice_*() allocations.

        * glib/gthread.[hc]:
        g_thread_foreach(): new public API function to loop over all existing threads.

        * glib/gdataset.c:
        * glib/gstring.c:
        * glib/gcache.c:
        * glib/garray.c:
        * glib/gqueue.c:
        * glib/gslist.c:
        * glib/glist.c:
        * glib/ghash.c:
        * glib/gtree.c:
        * glib/ghook.c:
        * glib/gmain.c:
        * glib/gnode.c:
        removed GAllocator and free list usages and accompanying locks.
        use g_slice_*() API to allocate and cache small bits of memory.

        * glib/ghook.h: removed GMemChunk field from public API.

        * glib/gslist.h:
        * glib/glist.h: deprecate allocator API, provide _free1() for consistency.

        * glib/gnode.h: deprecate allocator API.

        * glib/gmain.c: reordered GPollRec fields so g_slice_free_chain() can
        be used for poll rec lists.

        * glib/grel.c: removed mem chunk usage, and allocated tuples via g_slice_*().
        g_relation_destroy(): free all tuples from the all_tuples hash table,
        this effectively maintains the life time track keeping of tuples.
        g_relation_delete_tuple(): free tuples which are removed from the
        all_tuples hash table. this fixes a temporary leak that was present
        in the memchunk code until the destruction of the relation.
2005-11-01 18:10:31 +00:00
Matthias Clasen
21bbad188f Move a few strings from .data to .rodata.
2005-09-10  Matthias Clasen  <mclasen@redhat.com>

	* gtype.c (INVALID_RECURSION, check_type_name_I): Move a few strings
	from .data to .rodata.
2005-09-10 04:01:03 +00:00
Kjartan Maraas
2147c486b0 Remove some unused code. Same here And here Mark some functions static.
2005-09-08  Kjartan Maraas  <kmaraas@gnome.org>

	* gclosure.c: (g_closure_set_meta_marshal): Remove some unused
	code.
	* gsignal.c: (g_signal_emitv): Same here
	* gtype.c: (g_type_register_fundamental): And here
	* testgobject.c: Mark some functions static.
2005-09-08 06:35:44 +00:00
Matthias Clasen
63b1b0c187 More string interning 2005-08-31 17:56:49 +00:00
Stepan Kasal
0169468c8c Fix typos: invokation -> invocation. 2005-08-10 10:46:55 +00:00
Matthias Clasen
3448a27829 Make work again.
2005-03-14  Matthias Clasen  <mclasen@redhat.com>

	* abicheck.sh: Make work again.

	* gsourceclosure.c: Fix a typo.

	Make PLT-reduction work with gcc4, and don't include
	everything in gobjectalias.h:

	* gobject.symbols: Group symbols by header and source
	file.
	* makegobjectalias.pl: Protect definitions by the same
	preprocessor symbols used to guard the headers. Move
	the alias declarations to a separate file which is
	produced when calling makegalias.pl -def
	* Makefile.am (gobjectaliasdef.c): Add a rule to
	build this file.
	* *.c: Include gobjectalias.h after the other i
        GLib headers, include gobjectaliasdef.c at the bottom.
2005-03-14 06:47:51 +00:00
Matthias Clasen
286d84fcb0 glib/gdebug.h glib/gutils.c gobject/gtype.c gthread/gthread-posix.c
2004-11-01  Matthias Clasen  <mclasen@redhat.com>

	* glib/gconvert.c:
	* glib/gdebug.h
	* glib/gutils.c
	* gobject/gtype.c
	* gthread/gthread-posix.c
	* tests/timeloop-closure.c
	* tests/timeloop.c: Fix sparse warnings.  (#157014, Kjartan Maraas)
2004-11-01 18:47:12 +00:00
4
565d9253e7 applied patch from Jean-Yves Lefort <jylefort@brutele.be> to not access
Wed Oct  6 02:12:44 2004    <timj@birnet.org>

        * gtype.c (g_type_instance_get_private): applied patch from Jean-Yves
        Lefort <jylefort@brutele.be> to not access the instance_real_class_bsa
        pointer without holding the instance_real_class lock.
2004-10-06 00:15:07 +00:00
Matthias Clasen
465c7d1ead Implement the same PLT reduction technique used in GTK+:
2004-09-16  Matthias Clasen  <mclasen@redhat.com>

	Implement the same PLT reduction technique used in GTK+:

	* Makefile.am: Generate gobjectalias.h from gobject.symbols.
	(BUILT_SOURCES): Add gobjectalias.h.

	* makegobjectalias.pl: Script to generate gobjectalias.h.

	* *.c: Include gobjectalias.h
2004-09-16 18:52:40 +00:00
Matthias Clasen
88e7569e65 Add ABI control using the same technique that is used in GTK+.
2004-09-16  Matthias Clasen  <mclasen@redhat.com>

	Add ABI control using the same technique that is used in GTK+.

	* gobject.symbols: Master list of symbols.

	* gobject.def: Removed. It is now generated from gobject.symbols.

	* Makefile.am (gobject.def): Generate from gobject.symbols.
	(TESTS): Add abicheck.sh
	(EXTRA_DIST): Add abicheck.sh
	(export_symbols): Don't export _-prefixed symbols.

	* gtype.h:
	* gtype.c: Move the declarations of the various _init() functions
	to the header, and mark them as G_GNUC_INTERNAL.
2004-09-16 18:33:02 +00:00
Matthias Clasen
47bd02855f Catch cases of forgotten g_type_add_private(). (#148368, Tommi Komulainen)
2004-07-28  Matthias Clasen  <mclasen@redhat.com>

	* gtype.c (g_type_instance_get_private): Catch cases of
	forgotten g_type_add_private().  (#148368, Tommi Komulainen)
2004-07-28 15:32:07 +00:00
Tim Janik
999a87a19a provide a short-cut version for this macro in case
Tue Feb  3 21:24:01 2004  Tim Janik  <timj@gtk.org>

        * gtype.h (_G_TYPE_CVH): provide a short-cut version for
        this macro in case value->g_type==checked_type for gcc, similar
        to instance and class check short-cuts. this speeds up code that
        makes frequent use of G_VALUE_HOLDS_*() (e.g. setters/getters).

        * gtype.c (type_data_last_unref_Wm): don't call class-cache functions
        for the uncached case, this rendered g_type_class_unref_uncached()
        useless. pointed out by Stefan Westerfeld.
2004-02-03 20:30:23 +00:00
Matthias Clasen
07cbd50ea8 Don't acquire a read lock here. (#106433, Owen Taylor)
Fri Dec 26 01:34:01 2003  Matthias Clasen  <maclas@gmx.de>

	* gtype.c (g_type_class_peek_parent): Don't acquire a read lock
	here.  (#106433, Owen Taylor)
2003-12-26 00:36:56 +00:00
Tim Janik
0642df0ab3 variant of class_peek() which works for static types only.
Thu Nov 27 17:53:52 2003  Tim Janik  <timj@gtk.org>

        * gtype.[hc]:
        (g_type_class_peek_static): variant of class_peek() which works for
        static types only.

        * gobject.c:
        (g_object_do_class_init): make ::notify a run-action signal.
        (g_object_newv): use g_type_class_peek_static() by default to
        speed up common code path (trades two write-locks for one read-lock).
        (g_object_disconnect):
        (g_object_connect): allow signal specification words to be
        seperated by '-'.
        (g_object_set_valist):
        (g_object_new_valist): don't leak values.
        (g_object_get_property): check property for readability.
        (g_object_set_property): check property for writability and to
        not be construct-only.
        (g_object_set_valist): check property to not be construct-only.
2003-11-27 17:08:06 +00:00
Tim Janik
96a7e24043 fix post class_init interface initialization logic for child types.
Thu Oct  2 07:37:12 2003  Tim Janik  <timj@gtk.org>

        * gtype.c: fix post class_init interface initialization logic
        for child types.
2003-10-02 05:41:04 +00:00
Owen Taylor
1083b5a43d Add g_type_add/remove_interface_check(), which allows inserting a
Thu Oct  2 01:16:50 2003  Owen Taylor  <otaylor@redhat.com>

        * gtype.[ch]: Add g_type_add/remove_interface_check(),
        which allows inserting a post-interface-initialization
        check.

        * testgobject.c: Fix a deprecated usage.
2003-10-02 05:24:21 +00:00
Owen Taylor
2aa3d50768 Add g_type_default_interface_ref/peek/unref for accessing the default
Mon Sep 29 10:51:01 2003  Owen Taylor  <otaylor@redhat.com>

        * gtype.[ch]: Add g_type_default_interface_ref/peek/unref
        for accessing the default vtable of an interface.
2003-09-29 14:52:42 +00:00
Owen Taylor
61d764c54e You can have instance_real_class_bsa be non-NULL, but still the class not
Fri Sep 26 17:24:53 2003  Owen Taylor  <otaylor@redhat.com>

        * gtype.c (g_type_instance_get_private): You can
        have instance_real_class_bsa be non-NULL, but still
        the class not be in the bsa. (Found by Kris Rietveld)
2003-09-26 21:26:42 +00:00
Tim Janik
558507bc5a added support for a "default vtable" per interface, that interface vtables
Tue Sep  2 19:37:21 2003  Tim Janik  <timj@gtk.org>

        * gtype.[hc]: added support for a "default vtable" per interface,
        that interface vtables are initialized from.
        the default vtable is initialized and finalized through class_init,
        class_finalize and class_data from the interfaces GTypeInfo struct.
        (type_data_last_unref_Wm): unload child plugin before unreffing
        parent type.

        testifaceinit.c: minor fixups. fixed up base_init() assertions, since
        with a default vtable, base_init() may be called multiple times.
        added default initializer to iface1.
2003-09-02 17:57:22 +00:00
Tim Janik
de059b53bc fix iterating over fundamental types.
Tue Sep  2 14:53:41 2003  Tim Janik  <timj@gtk.org>

        * gobject-query.c (main): fix iterating over fundamental types.

        * gtype.c: applied patch from owen which keeps internal
        class initialization state to maintain class and interface
        initialization happen in the order of:
        1. class' base_init
        2. interface' base_init
        =  interfaces added after here are immediately base_init-ialized
        3. class_init
        4. Interface_init
        =  interfaces added here are immediately Interface_init-ialized
2003-09-02 12:58:23 +00:00
Tim Janik
105adb9a35 check private instance data after initialization.
Tue Aug 19 05:21:04 2003  Tim Janik  <timj@gtk.org>

        * testgobject.c (main): check private instance data after
        initialization.

        * gtype.c: for instances with private data, store the real class
        pointer in a bsearch array during class initialization.
        (g_type_instance_get_private): fetch the real class of
        an instance from the bsearch array if necessary.
2003-08-19 03:25:46 +00:00
Soeren Sandmann
6e2d715fd8 Only access node->data->instance when the node is instantiable.
Tue Jul  8 22:29:31 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtype.c (type_class_init_Wm): Only access node->data->instance
	when the node is instantiable.
2003-07-08 20:12:05 +00:00
Owen Taylor
2d9b959c98 Initialize node->data->instance.private_size here rather than in
Tue Jul  8 14:55:27 2003  Owen Taylor  <otaylor@redhat.com>

        * gtype.c (type_class_init_Wm): Initialize
        node->data->instance.private_size here rather than
        in type_data_make_W() since the class init for the parent
        class may have changed pnode->data->instance.private_size.
        (#116921, reported by Soeren Sandmann)
2003-07-08 18:59:04 +00:00
Sven Neumann
537c81b30b removed leftover debugging message (bug #109093).
2003-03-24  Sven Neumann  <sven@gimp.org>

	* gtype.c (type_data_finalize_class_ifaces_Wm): removed leftover
	debugging message (bug #109093).
2003-03-24 16:59:09 +00:00
Owen Taylor
c2a431c894 Add support for instance-private data. g_type_class_add_private(),
Thu Feb 27 17:33:19 2003  Owen Taylor  <otaylor@redhat.com>

        * gtype.[ch] testgobject.c: Add support for instance-private data.
        g_type_class_add_private(), g_type_instance_get_private(),
        G_TYPE_INSTANCE_GET_PRIVATE(). (#101959, patch partly by
        Mark McLoughlin, extensive feedback from Tim Janik.)
2003-03-10 16:41:28 +00:00
Matthias Clasen
fa21b512d5 Remove all docs from gobject at Tims request. Documentation is only for
2003-02-07  Matthias Clasen  <maclas@gmx.de>

	* gtypemodule.c:
	* gtype.c:
	* gsourceclosure.c:
	* gparamspecs.c:
	* gparam.c:
	* gobject.c:
	* gsignal.c: Remove all docs from gobject at Tims
	request. Documentation is only for weenies anyway...
2003-02-07 22:04:24 +00:00
Michael Natterer
63f5a15fc6 applied patch I got from Tim Janik for testing which fixes bug #101521.
2002-12-18  Michael Natterer  <mitch@gimp.org>

	* gobject/gtype.c (type_data_finalize_class_ifaces_Wm): applied
	patch I got from Tim Janik for testing which fixes bug #101521.
	(restart iterating the interface enties each time we finalized one
	because they might have been modified).
2002-12-18 18:16:07 +00:00
Matthias Clasen
6df677db74 Sync parameter names with docs and implementation.
* gsignal.h (g_signal_add_emission_hook):
	* gtype.h (g_type_interface_get_plugin): Sync parameter names with
	docs and implementation.

	* gtype.c (g_type_add_interface_dynamic):
	(g_type_interface_get_plugin):
	(g_type_interface_peek_parent):
	(g_type_query): Add docs.

	* gobject/tmpl/gtype.sgml: Add docs.

	* gobject/tmpl/signals.sgml: Regenerated.
2002-12-03 23:54:55 +00:00
Matthias Clasen
e2afe00eb1 Add docs. 2002-12-02 23:48:52 +00:00
Matthias Clasen
a69dc4b65d Mark 2.2 API additions. 2002-11-28 00:15:45 +00:00
Owen Taylor
892675e05a Allow NULL to be cast to any type. (Frequently requested, most recently
Thu Nov 21 16:05:50 2002  Owen Taylor  <otaylor@redhat.com>

        * gtype.c (g_type_check_instance_cast): Allow
        NULL to be cast to any type. (Frequently requested,
        most recently #99023, Lars Clausen.)
2002-11-22 03:03:15 +00:00
Owen Taylor
d4407e38fa Include config.h so DISABLE_MEMPOOLS actually has an effect. (#96437,
Mon Nov  4 14:41:48 2002  Owen Taylor  <otaylor@redhat.com>

        * glib/gbsearcharray.c: Include config.h
        so DISABLE_MEMPOOLS actually has an effect.
        (#96437, Morten Welinder)

        * tests/uri-test.c: Include <config.h>

Mon Nov  4 14:42:36 2002  Owen Taylor  <otaylor@redhat.com>

        * gtype.c gsignal.c gvaluearray.c: Include config.h
        so DISABLE_MEMPOOLS actually has an effect.
        (#96437, Morten Welinder)

        * gsignal.c: Conditionalize definition of g_handler_ts
        on DISABLE_MEM_POOLS (#96437)

Mon Nov  4 14:45:24 2002  Owen Taylor  <otaylor@redhat.com>

        * gthread-posix.c gthread-solaris.c: Include <config.h>
2002-11-04 20:09:48 +00:00
Matthias Clasen
b95ffb852c Report only the most specific instantiatable prerequisite, filter out all
* gtype.c (g_type_interface_prerequisites): Report only the most
	specific instantiatable prerequisite, filter out all supertypes of
	this one (the supertypes are added to the prerequisites array for
	technical reasons).
2002-10-19 23:59:51 +00:00