This seems to be causing some issues with clobbering memory values, and
since there is callback functionality already working, this seems
unnecessary.
* Make all calculations local to function
I moved from making the assignments and calculations of certain memory
values to doing the calculations on local variables and assigning them
at the end of the function for update_meminfo().
This is to keep the info.memX variables from having 'intermediary'
values that may give wrong values to other functions if the structure is
read from while the function is currently executing.
As a matter of keeping the variables consistent across function calls, I
removed the zeroing out of certain info struct variables so that if they
are read from, they'll still report a sane value. Since the only change
to the value a direct assignment at the end of the function, they
shouldn't need zeroing out in the first place.
There's not a single instance of using info.bufmem in any other source
file aside from linux.cc. If there was any plan to use this check (and
info.bufmem) with any other source file, the check should be made in
that specific source file instead.
This fixes #650 'Bad arguments: " unk" and '59"' where `link_qual_max`
would occasionally get updated with an invalid value. Now the update
will ignore bad values and only use valid numbers.
Graphs would appear to change their previous data when any of the
displayed special types (e.g. $color, $hr, $offset) was added or removed
from the display (e.g. from a conditional statement). This is because
Graphs were just looking at memory locations for previous graph data,
but those locations could change if any special types were added or
removed. Now the previous graph data will get stored explicitly.
The specific behavior was retained as far as the exact timings of
the ++/--. Maybe it can get cleaned up more, but at least the
if statement logic is more clear now.
Nested exec expressions like ${execp echo '${execp echo hi}'} are not
evaluated correctly because parsing expressions like these generates and
registers new callbacks but we never wait for these callbacks to
complete before returning the result of the evaluation.
Fix this by re-evaluating expressions after running all pending
callbacks.