Hi Brenden,
Below is an updated patch, it works for me with the master.
p.s: don't forget to use git-am to apply the patch ;p
Signed-off-by: Brenden Matthews <brenden@rty.ca>
This patch is written by a anonymous author, see patch on sf.net
id #2663691 . I changed it a bit so that it can't overwrite
existing environment variables and updated the docs and syntaxfiles
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.