summaryrefslogtreecommitdiffstats
path: root/CPUMeter.c
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2016-05-04 13:39:26 +0800
committerExplorer09 <explorer09@gmail.com>2016-05-04 13:39:26 +0800
commit9dea20e06847f930920406e6de539db32e2644e0 (patch)
tree9fa1d0fcf5d166ad0b8fddb74ba541b0252d1727 /CPUMeter.c
parent2ea4bee66dfe496ee649ecb81245b70554774975 (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 'CPUMeter.c')
-rw-r--r--CPUMeter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/CPUMeter.c b/CPUMeter.c
index 4a945c0e..32bad049 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -55,7 +55,7 @@ static void CPUMeter_init(Meter* this) {
Meter_setCaption(this, "Avg");
}
-static void CPUMeter_setValues(Meter* this, char* buffer, int size) {
+static void CPUMeter_updateValues(Meter* this, char* buffer, int size) {
int cpu = this->param;
if (cpu > this->pl->cpuCount) {
snprintf(buffer, size, "absent");
@@ -215,7 +215,7 @@ MeterClass CPUMeter_class = {
.delete = Meter_delete,
.display = CPUMeter_display
},
- .setValues = CPUMeter_setValues,
+ .updateValues = CPUMeter_updateValues,
.defaultMode = BAR_METERMODE,
.maxItems = CPU_METER_ITEMCOUNT,
.total = 100.0,

© 2014-2024 Faster IT GmbH | imprint | privacy policy