GNOME Bugzilla – Bug 315278
Possible cleanup in gmain.c
Last modified: 2005-09-11 15:20:29 UTC
The Intel compiler complains about some cases of dead code in here and when I started poking at it there was a bit of the old snowball effect :-)
Sorry, wrong version.
Created attachment 51819 [details] [review] possbile cleanups
The child_watch_helper_thread thread change looks fine (check to make sure that GCC doesn't warn about the removal of the trailing return NULL.) Maybe you can explain the rest of the patch? It doesn't make immediate sense to me. (Or look like it would even compile.)
icc complained that child_watch_source was set but never used in g_child_watch_check() so I removed those two lines. While there I noticed that g_child_watch_prepare() had the same issue and after removing those lines from there it ended up just setting timeout = -1 and returning. So I looked for uses of that function in that file since it was static and there were none. So if the function was unused and static I figured it also didn't need to be ported to Win32. It does compile here with icc, trying gcc now...it compiles but with the following warning: gmain.c:286: warning: initialization from incompatible pointer type gmain.c:287: warning: initialization from incompatible pointer type Looking at the code it's clear that removing it is probably the wrong thing to do, but is icc right in complaining about the variables being set and never used?
You are right that the variables can be removed, but I think you missed the fact the the return statement does the actual work: return check_for_child_exited (source); The function is used as a function pointer: GSourceFuncs g_child_watch_funcs = { g_child_watch_prepare, g_child_watch_check, g_child_watch_dispatch, NULL }; This gives a list of functions for the main looop to use at various stages. If you remove the first line, then you have check in the prepare slot and dispatch in the check slot, and NULL in the dispatch slot, and things wont' work at all well :-)
Indeed I did ;-) So, after removing the fluff we have two matching functions with different names only one of them takes a gint parameter that it never uses for anything...
Created attachment 51863 [details] [review] updated patch
The *timeout = -1 (note the '*') is not extraneous and cannot be removed.
Created attachment 51864 [details] [review] updated patch Hopefully this time it's correct then :-)
Yes, looks correct now. Please commit to head only.
Commited.