slice allocator

2007-02-03 Thread Philip Kovacs
Anyone happen to know at approximately what memory size the slice allocator defaults back to g_malloc? Just thinking that if my allocations are too large for the slice allocator, causing it to drop back to g_malloc anyway, that I should consider using g_malloc directly and using GTrashStack to re

GObject ref counting

2006-12-27 Thread Philip Kovacs
Is it good practice always to ref count GObject's passed into functions -- even if you know for certain that the primary reference is in your control, i.e. the first reference cannot be unref'd by surprise? For large, complex objects with many api's, most of which are private, I find that all th

Re: Musings on the proper use of g_error and GError

2006-09-03 Thread Philip Kovacs
Suppose one issues a connect() on a socket fd. Would it be correct to set a GError if the call returned a "soft" error code like EAGAIN or ECONNREFUSED, but to throw a hard g_error if it were, e.g. EFAULT? "Recoverable" is in the eye of the beholder, no? Also, since "g_error should only be used

Musings on the proper use of g_error and GError

2006-09-02 Thread Philip Kovacs
The glib documentation on error reporting is very specific on differentiating between runtime recoverable errors and programming errors: http://developer.gnome.org/doc/API/2.0/glib/glib-Error-Reporting.html Of interest to me is the rather strong statement that: "... the |g_error()|

Re: GObject exposure

2006-08-22 Thread Philip Kovacs
|Maybe it is just me, but I don't see a problem with letting users access the object with gobject methods. If |you look at the api, there aren't that many, and there don't seem to be any that would harm too much. Also, |restricting access too much prevents people from using it in (perhaps bene

GObject exposure

2006-08-21 Thread Philip Kovacs
I have a question related to whether or not I need to go to more deliberate lengths to hide/shield the gobject's I am producing from the users of my library. The api's I have implemented deliver (what I wish to be) opaque pointers to the users of the library. There are _new, _free and a whole s

propagating errors w.r.t. quark/domain visibility

2006-07-27 Thread Philip Kovacs
Is it considered bad form to g_propagate_error() a custom error back to a caller, when the error domain, enum and quark definitions are not visible to the caller? Example: --bar.h-- (an internal module, not seen by the caller) typedef enum { BAR_ERROR_THIS, BAR_ERROR_THAT } BarError;

Re: GValue won't init inside hidden functions

2006-06-28 Thread Philip Kovacs
John Cupitt wrote: > Did you remember to initialise the GValue to {0}? The following > program runs with no warnings for me. OK, I am guilty, as charged. I failed to zero-fill the GValue structure when I defined it (as a stack variable). The documentation for GValue states: "To create a undef

GValue won't init inside hidden functions

2006-06-28 Thread Philip Kovacs
I am using glib 2.10.3 at the moment with gcc 3.4.6 and glibc 2.3.6. I have noticed that issuing a g_value_init() on a GValue produces the error: GLib-GObject-WARNING **: gvalue.c:89: cannot initialize GValue with type `gpointer', the value has already been initialized as `(null)' whenever the

destroying GTypeModule object?

2006-05-27 Thread Philip Kovacs
Is it ever safe to destroy a GTypeModule object after it is created and load() runs (to initialize/register the plugin types?). The g_type_module_unuse() documentation states: "Once a GTypeModule is initialized, it must exist

Re: gobject, dynamic loading of classes

2006-05-09 Thread Philip Kovacs
I am working with GTypeModule to load gobject types that register types dynamically. These types derive from an abstract base class defined statically in the main code. It works fine, but one thing I notice is that any header files you distribute for the dynamic "plugin" types cannot define _ge

implementing plugin types with a common base type

2006-04-23 Thread Philip Kovacs
Hi. I am developing a glib/gobject application that makes use of GTypeModule to load plugins that register service types with GType. I would like to derive these service types from a common gobject type.The question I have is where to define that common base type. I notice that this ba