Yes, I also thought these are monotonic counters. But it seems like they
are not, at least sometimes the value decreases by 1 leading to a very
very high cpu usage percentage being printed.
These macros can be used just like their OBJ() and OBJ_IF()
counterparts, just that they bail out hard when arg is unset. While
here, also cleanup the macro definition by using __* macros and fully
cleanup the macro namespace when the job is done.
Although this makes conky kind of less robust when it comes to
configuration errors, aborting is the right thing to do to avoid
ambiguity between unknown text objects.
Normally, this is not enough reason to remove code, but in this case it
means that either the tester always had $nvidia (if enabled) or $combine
also in her setup, or it was working without (which I guess, since there
is duplicate code in update_apcupsd()).
There are no INFO_* variables any more, so the argument passed to OBJ()
is always a function pointer or zero. By checking the argument passed in
add_update_callback(), the branch in the OBJ() macro can be dropped,
too.
* Remove leftover INFO_* values from object definitions which didn't
trigger anything.
* Drop the whole INFO_* enum as it's values are not used anymore.
* Drop all need_mask alterations (no idea why there were here at all,
but surely not sane since they are missing in the non-linux
functions).
* Drop the update delay for update_meminfo(), as parsing /proc should
not lead to abnormal overhead.
* Check for x_initialised from inside update_x11info(), so we can call
it unconditionally.
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.
The headerfile used globally should be used instead of one in the local dir.
If conky can't find it, it should be fixed in configure.ac.in or Makefile.am,
and not in the code.