diff options
author | Explorer09 <explorer09@gmail.com> | 2016-05-04 13:39:26 +0800 |
---|---|---|
committer | Explorer09 <explorer09@gmail.com> | 2016-05-04 13:39:26 +0800 |
commit | 9dea20e06847f930920406e6de539db32e2644e0 (patch) | |
tree | 9fa1d0fcf5d166ad0b8fddb74ba541b0252d1727 /BatteryMeter.c | |
parent | 2ea4bee66dfe496ee649ecb81245b70554774975 (diff) |
Rename Meter.setValues() functions to updateValues()
Rationale (copied from htop issue #471):
The function name "setValues" is misleading. For most OOP (object-
oriented programming) contexts, setXXX functions mean they will change
some member variables of an object into something specified in
function arguments. But in the *Meter_setValues() case, the new values
are not from the arguments, but from a hard-coded source. The caller
is not supposed to change the values[] to anything it likes, but
rather to "update" the values from the source. Hence, updateValues is
a better name for this family of functions.
Diffstat (limited to 'BatteryMeter.c')
-rw-r--r-- | BatteryMeter.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/BatteryMeter.c b/BatteryMeter.c index 622b7798..0031050f 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -32,7 +32,7 @@ int BatteryMeter_attributes[] = { BATTERY }; -static void BatteryMeter_setValues(Meter * this, char *buffer, int len) { +static void BatteryMeter_updateValues(Meter * this, char *buffer, int len) { ACPresence isOnAC; double percent; @@ -73,7 +73,7 @@ MeterClass BatteryMeter_class = { .extends = Class(Meter), .delete = Meter_delete }, - .setValues = BatteryMeter_setValues, + .updateValues = BatteryMeter_updateValues, .defaultMode = TEXT_METERMODE, .maxItems = 1, .total = 100.0, |