rework the update machinery to use callbacks
authorPhil Sutter <phil@nwl.cc>
Sun, 6 Sep 2009 22:14:54 +0000 (00:14 +0200)
committerPhil Sutter <phil@nwl.cc>
Sun, 6 Sep 2009 22:36:02 +0000 (00:36 +0200)
commitd7c7f06aca96d8ad13d395212c74d2235c07dac6
tree5883c76e9bef464464092e32fce857759b3aa494
parent8cf8c4dac3a0f47f57e2bcb1c31b5bdee0dea727
rework the update machinery to use callbacks

Besides improving performance when updating stuff, we ideally have no
text object specific code in update_stuff() anymore (aside some
leftovers).

The macros in construct_text_object() have gotten a bit crazier than
they were before:
* using CALLBACK(&func) instead of an INFO_* parameter to OBJ() will
  make it add the given callback to the list of callbacks to be iterated
  over at each update interval.
* BEWARE: the above assumes function pointer values to be > 0!
* This implicitly fixes a bug in the code: passing 0 as INFO_* value
  led to selecting INFO_MAIL (1 << 0 == 1).
* Now it would select INFO_CPU (== 0), which got unused and therefore is
  not a problem at all (the 0 value should be unused in enums anyway).

This needs some more work, then we should be able to drop the whole
INFO_* enum. Then CALLBACK() can die again and with it goes the ugly
casting stuff done to distinguish callbacks from INFO_* values.
src/common.c
src/common.h
src/conky.c
src/core.c
src/fs.c
src/moc.c
src/moc.h