Changeset 6ad7bed for window.c


Ignore:
Timestamp:
Nov 6, 2010, 6:34:03 PM (10 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
ce35060
Parents:
1d81c51
git-author:
David Benjamin <davidben@mit.edu> (08/07/10 21:07:19)
git-committer:
Anders Kaseorg <andersk@mit.edu> (11/06/10 18:34:03)
Message:
Avoid stripping parameters for function calls in window.c

Although glib depends on this cast to work, clang tries to inline
owl_window_children_foreach and emits a warning. Unfortunately, we still
depend on this trick to work in general, by depending on glib.

Reported-By: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • window.c

    r4811422 r6ad7bed  
    4545static owl_window *default_cursor;
    4646
     47/* clang gets upset about the glib argument chopping hack because it manages to
     48 * inline owl_window_children_foreach. user_data should be a pointer to a
     49 * FuncOneArg. */
     50typedef void (*FuncOneArg)(void *);
     51static void first_arg_only(gpointer data, gpointer user_data)
     52{
     53  FuncOneArg *func = user_data;
     54  (*func)(data);
     55}
     56
    4757G_DEFINE_TYPE (OwlWindow, owl_window, G_TYPE_OBJECT)
    4858
     
    288298{
    289299  owl_window_show(w);
    290   owl_window_children_foreach(w, (GFunc)owl_window_show, 0);
     300  FuncOneArg ptr = (FuncOneArg)owl_window_show;
     301  owl_window_children_foreach(w, first_arg_only, &ptr);
    291302}
    292303
     
    348359  owl_window_dirty(w);
    349360  /* map the children */
    350   owl_window_children_foreach(w, (GFunc)_owl_window_realize_later, 0);
     361  FuncOneArg ptr = (FuncOneArg)_owl_window_realize_later;
     362  owl_window_children_foreach(w, first_arg_only, &ptr);
    351363}
    352364
     
    356368    return;
    357369  /* unmap all the children */
    358   owl_window_children_foreach(w, (GFunc)_owl_window_unrealize, 0);
     370  FuncOneArg ptr = (FuncOneArg)_owl_window_unrealize;
     371  owl_window_children_foreach(w, first_arg_only, &ptr);
    359372  _owl_window_destroy_curses(w);
    360373  w->dirty = w->dirty_subtree = 0;
     
    410423void owl_window_dirty_children(owl_window *w)
    411424{
    412   owl_window_children_foreach(w, (GFunc)owl_window_dirty, 0);
     425  FuncOneArg ptr = (FuncOneArg)owl_window_dirty;
     426  owl_window_children_foreach(w, first_arg_only, &ptr);
    413427}
    414428
     
    434448    return;
    435449  _owl_window_redraw(w);
    436   owl_window_children_foreach(w, (GFunc)_owl_window_redraw_subtree, 0);
     450  FuncOneArg ptr = (FuncOneArg)_owl_window_redraw_subtree;
     451  owl_window_children_foreach(w, first_arg_only, &ptr);
    437452  w->dirty_subtree = 0;
    438453}
Note: See TracChangeset for help on using the changeset viewer.