<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Ikke wrote:
<blockquote cite="mid1144063765.15494.4.camel@marslander.trangez.int"
type="cite">
<blockquote type="cite">
<pre wrap="">Just started working on a minor patch for this. Although I doubt it'll
be accepted... Who knows ;-)
</pre>
</blockquote>
<pre wrap=""><!---->
Attached (sorry for the lag, food etc :-))
Not extensively tested, blablabla. Should I get this into gnome
bugzilla?
</pre>
</blockquote>
<blockquote cite="mid1144063765.15494.4.camel@marslander.trangez.int"
type="cite">
<pre wrap="">+ /* Keep standard behaviour */
+ if (G_LIKELY(g_malloc_failure_handler == NULL))
+ {
g_error ("%s: failed to allocate %lu bytes", G_STRLOC, n_bytes);
+ }
+ else
+ {
+ g_warning("%s: failed to allocate %lu bytes", G_STRLOC, n_bytes);
+ g_malloc_failure_handler (n_bytes);
+ }
}
</pre>
</blockquote>
<br>
Not very interesting:<br>
<br>
1. You give no way of avoiding the warning<br>
2. You give no way of allocating the memory from somewhere else (e.g.
emergency pool, wait & retry...)<br>
<br>
Why not just:<br>
<br>
...<br>
+ if (g_malloc_failure_handler)<br>
+ return g_malloc_failure_handler (n_bytes);<br>
g_error ("%s: failed to allocate %lu bytes", G_STRLOC, n_bytes);<br>
...<br>
<br>
<br>
</body>
</html>