Conversation
|
Any reason, why you dropped 2538896 from this series? |
|
Sure, just noticed when comparing your branches. LGTM. |
0437114 to
45d779a
Compare
45d779a to
a4a08bc
Compare
|
More code refactoring, and thus it's good to re-review this.
|
47d1c3b to
63b776c
Compare
63b776c to
e5bcc4f
Compare
|
Will do. All of these are style changes being mixed with changes in behavior. Do you mean to drop the style changes or split them into seperate commits? I think you're interested in some size reports: I gathered these from GitHub Actions CI. And you are right in that using |
I'm a little confused what you mean by "code structure and functional changes are mixed" and how should I split the commits. |
In the first commit, there's this
(b) and (c) are fine. Basically we have (b) right now. Be sure to update the format strings accordingly and you'll be able to skip that one cast. |
e5bcc4f to
e77a3d4
Compare
The use of CUSTOM_METERMODE value in meter default mode was a bad design. There are no meter that really has a "custom" mode to work with and currently that value serves as a useless placeholder that hides the real default mode for a meter. Replace CUSTOM_METERMODE in `defaultMode` of all meters with the real intended default modes. Currently only CPU meters and MemorySwapMeter used this, and their real defaults are BAR_METERMODE. In Meter_setMode(), remove the special treatment of `defaultMode == CUSTOM_METERMODE`, Meter_setMode() still calls the `updateMode` function for custom treatment when it's present for a meter class. As CUSTOM_METERMODE is obsolete from `defaultMode`, the init functions of CPU meters and MemorySwapMeter need to be adjusted to avoid incomplete initialization (Meter.draw function bring NULL). Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Let the respective `MeterClass.updateMode` functions initialize the meter mode instead. The `updateMode` function is always called after the `MeterClass.init` function by `Meter_new()`. This not only simplifies the init functions of meter subclasses, but avoids the use of the global `Meter_modes` array when it's unnecessary. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Meter mode ID 0 will now be reserved.
The Meter objects have their own 'h' properties. Avoid access to the `Meter_modes` array. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
The Meter objects have their own 'h' properties. Avoid access to the `Meter_modes` array. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This section reordering is a prerequisite to privatizing the `Meter_modes` array.
All client codes that access this global `Meter_modes` array have been replaced in previous commits, thus it's no longer necessary to keep this internal information (draw functions, default heights, etc.) public. It was also a bad idea when the client codes need to avoid accessing `Meter_modes[0]` (which is reserved and contains null information) by themselves. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This is a prerequisite to using MeterModeId type in more headers, to avoid header dependency hell.
All uses of meter drawing "mode" numbers now have the type `MeterModeId`, including the uses in structures and arrays. `MeterModeId` is defined as `unsigned int`, as (currently) it doesn't save any code size by defining it to any smaller type. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
e77a3d4 to
e2fd54c
Compare
e2fd54c to
a2ab9ad
Compare
The main goal of this set of patches is to remove the use of
CUSTOM_METERMODEindefaultModevalues, and to adjustMeter_setMode()code in preparation of thesupportedModesfeature (PR #1387).