Fixed indentation
This commit is contained in:
parent
69ec05bb07
commit
e74ceb4c45
@ -6,7 +6,7 @@ pub const BatteryInfo = struct {
|
||||
Manufacturer: []u8,
|
||||
Model: []u8,
|
||||
Technology: []u8,
|
||||
Status: []u8,
|
||||
Status: []u8,
|
||||
CellSeriesCount: u32 = 0,
|
||||
Capacity: u32 = 0,
|
||||
CapacityDesign: u32 = 0,
|
||||
@ -22,15 +22,15 @@ pub const BatteryInfo = struct {
|
||||
self._allocator.free(self.Manufacturer);
|
||||
self._allocator.free(self.Model);
|
||||
self._allocator.free(self.Technology);
|
||||
self._allocator.free(self.Status);
|
||||
self._allocator.free(self.Status);
|
||||
}
|
||||
};
|
||||
|
||||
fn _readInfo(allocator: std.mem.Allocator, dir: std.fs.Dir, path: []const u8) ![]u8 {
|
||||
const start = try dir.readFileAlloc(allocator, path, _maxRead);
|
||||
defer allocator.free(start);
|
||||
const trimmed = std.mem.trim(u8, start, "\r\n\t ");
|
||||
return allocator.dupe(u8, trimmed);
|
||||
defer allocator.free(start);
|
||||
const trimmed = std.mem.trim(u8, start, "\r\n\t ");
|
||||
return allocator.dupe(u8, trimmed);
|
||||
}
|
||||
|
||||
fn _readInfoU32(allocator: std.mem.Allocator, dir: std.fs.Dir, path: []const u8) !u32 {
|
||||
@ -43,13 +43,13 @@ pub fn GetBatteryInfoAlloc(allocator: std.mem.Allocator, dir: std.fs.Dir) !Batte
|
||||
const manufacturer = try _readInfo(allocator, dir, "manufacturer");
|
||||
const model = try _readInfo(allocator, dir, "model_name");
|
||||
const technology = try _readInfo(allocator, dir, "technology");
|
||||
const status = try _readInfo(allocator, dir, "status");
|
||||
const status = try _readInfo(allocator, dir, "status");
|
||||
|
||||
var info = BatteryInfo{
|
||||
.Manufacturer = manufacturer,
|
||||
.Model = model,
|
||||
.Technology = technology,
|
||||
.Status = status,
|
||||
.Status = status,
|
||||
._allocator = allocator,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user