Re: DeviceKit and /usr
On Mon, Sep 07, 2009 at 04:36:53PM +0200, Josselin Mouette wrote:
> Case 1:
> char *foo;
> if (asprintf(&foo, "%s equals %i", somestring, someint) < 0) {
> fprintf(stderr, "Failed to allocate memory");
> abort();
> }
>
> Case 2:
> char *foo = g_strdup_printf ("%s equals %i", somestring,
> someint);
That shows exactly why glib cannot be used for low-level stuff and
daemons: it aborts unconditionally if a memory allocation fails. It's
rather sad, otherwise I love to use glib.
Gabor
--
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------
Reply to: