As a side effect, font and colour specific stuff got outsourced, too.
This is because the apropriate functions are used by conky.c as well as
specials.c, so they should be kept on their own.
In the long term I hope for positive impact on the X11 integration mess.
(Take e.g. the mass of X11 ifdefs cluttering conky.c.) Though this
commit contains no optimisations in this direction, just plain
outsourcing, to ensure minimised (intended: none) changes to conky's
interface behaviour.
Since we have no doxygen compatible code comments (we hardly have
comments at all ;) there is not much documentation to be extracted. But
this is still useful, as doxy generates us nice callgraphs showing the
internal code flow chaos. :)
Usage is as follows: after having run ./autogen.sh, doxygen can be
triggered by simply issuing 'make doxy'. This will generate a doxy
config if none exists, and preset some stuff inside (especially
parsing of undocumented stuff). Before all consecutive invocations, the
doxy config (named 'Doxyfile') can be customised to one's personal
needs.
In fact these two objects share a lot of code, so the bigger plan is to
merge them into a single file to share equal code.
This should not change anything to the code flow, besides making conky
startup a bit more robust due to less use of CRIT_ERR.
Well, not really. I don't dare putting it all together into a single
source file, as that would just not make sense. Instead, this patch
eliminates the --enable-smapi configure option and all related checks,
replacing them with the equivalents from --enable-ibm.
Despite this is actually not much code and could stay inside linux.c as
well, this makes sense as I want to combine smapi and ibm-acpi
functionality. Virtually every user of a notebook made by IBM/Lenovo
will want both, so this should be a feature not a bug.
Besides making the ibm-acpi objects being built optionally, this should
not change anything to the code flow.
Instead of using a hardcoded maximum number of slots for
stats of different disks, use a linked list. Also since the algorithm to
update each device's counters is the same for updating the totals, share
equal code, which in my eyes not only saves a bunch of LoC, but also
drastically increases readability.
The segfault can be triggered by using any diskio object with a
non-existent device, as prepare_diskio_stat() then returns 0 and the
call to obj->data.diskio->current in conky.c:4050 pulls the trigger.
In fact, it's not a problem when the device doesn't exist, as
update_diskio() simply won't fill in any values. So skip the check and
upon device node appearance everything goes it's normal way.
While there, also eliminate double readout of the last line of
/proc/diskstats: after the last line has been read, FEOF is not yet set.
BUT fgets() will return NULL when trying to read the next line. So
better check for fgets()'s return value instead of using feof().
Also strncmp() is useless here, since we really want to compare the full
paths. Besides, text_buffer_size also should be big enough to not make a
difference here.
Also, note that free() does not zero the passed pointer. So conditional
freeing always needs to look like this:
| if (var) {
| free(var);
| var = 0;
| }
* change the height of execbar and execibar to be the same as other
bars have by default (6 pixels)
* treat mixer values as percentages as they're usually 0-100 (switch
to spaced_print() with pad_percents)
* change temp_print() from snprintf() to spaced_print()
* remove decimals from temp_print() as none of the current sources can
supply values smaller than 1 degree (C or F, doesn't matter)
* add a space between number and the unit in human_readable()
* fix number printing in human_readable()
* network $upspeed and $downspeed now use human_readable()
This makes it possible for the compiler to do better optimizations by
adding "static" to functions which do not need to be exported.
Since some of them (e.g. the compare_*() functions) are called very
often, this may decrease conky's need of resources a bit.
With my last patch I did only update the XML documentation file without
updating the auto-generated manpage and README file.
This patch also updates README and conky.1.
Since there is no choice of which moc player to get information from,
all moc objects' data source can be identical. Also hide some internal
data (the thread e.g.). Since from now on there can only be one moc
thread (not highlander ;), we don't need to treat the thread object
specially.
While here, fix indenting.
All objects parsing text into objects formerly parsed and evaluated
their arguments each update interval. This does only make sense when the
parsed text could change between updates, which is the case for execp
and execpi objects, but none of the others. So have them parse the text
when creating them, so each update interval only the output has to be
re-extracted.
In fact, this should give a performance boost when using any of the
affected objects, as parsing the input text is quite expensive since
we're evaluating templates.
Using a global ifblock stack for all parsed ifblock objects causes
problems when doing sub-parsing in objects taking other objects as
parameters, because the possibly non-empty stack at startup leads to
false alarm when checking for stack emptiness after parsing the objects.
Use a void ** as the object to pass around, so callers don't need to
know struct ifblock_stack_obj.
In fact, they are. But we don't want to treat them as those, because
the rewrite made the only situation when threaded objects matter
uncritical, i.e. when an object calls calling parse_conky_vars().
In general, argument types should match, but for combined long and
double usage the long is being converted to double before evaluation.
A few examples:
${if_match ${cpu} < 30}
${if_match "asdf" != "qwer"}
${if_match 0.5 < 0.50001}
${if_match 49.999 < 50}