diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-02 17:02:03 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-02 17:02:03 +0200 |
| commit | 03fc51d8d63cebe8cddb55f60be0142257dd0288 (patch) | |
| tree | dfebc6865423c9ed0171e885f513dde66f8c1054 | |
| parent | ea7f5d4064984d06dbf07d2463f7812c482f985f (diff) | |
| download | river-03fc51d8d63cebe8cddb55f60be0142257dd0288.tar.gz river-03fc51d8d63cebe8cddb55f60be0142257dd0288.tar.xz | |
Eliminate some magic numbers
| -rw-r--r-- | river/Root.zig | 4 | ||||
| -rw-r--r-- | river/view_stack.zig | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/river/Root.zig b/river/Root.zig index fe07e7e..d411739 100644 --- a/river/Root.zig +++ b/river/Root.zig @@ -137,7 +137,7 @@ fn startTransaction(self: *Self) void { var output_it = self.outputs.first; while (output_it) |node| : (output_it = node.next) { const output = &node.data; - var view_it = ViewStack(View).iterator(output.views.first, 0xFFFFFFFF); + var view_it = ViewStack(View).iterator(output.views.first, std.math.maxInt(u32)); while (view_it.next()) |view_node| { const view = &view_node.view; // Clear the serial in case this transaction is interrupting a prior one. @@ -222,7 +222,7 @@ fn commitTransaction(self: *Self) void { output.pending_focused_tags = null; } - var view_it = ViewStack(View).iterator(output.views.first, 0xFFFFFFFF); + var view_it = ViewStack(View).iterator(output.views.first, std.math.maxInt(u32)); while (view_it.next()) |view_node| { const view = &view_node.view; // Ensure that all pending state is cleared diff --git a/river/view_stack.zig b/river/view_stack.zig index 0543d03..36be14b 100644 --- a/river/view_stack.zig +++ b/river/view_stack.zig @@ -275,7 +275,8 @@ test "push/remove (*View)" { test "iteration (View)" { const c = @import("c.zig"); - const testing = @import("std").testing; + const std = @import("std"); + const testing = std.testing; const allocator = testing.allocator; @@ -315,7 +316,7 @@ test "iteration (View)" { // Iteration over all tags { - var it = ViewStack(View).iterator(views.first, 0xFFFFFFFF); + var it = ViewStack(View).iterator(views.first, std.math.maxInt(u32)); testing.expect((if (it.next()) |node| &node.view else null) == &two_a.view); testing.expect((if (it.next()) |node| &node.view else null) == &five_b.view); testing.expect((if (it.next()) |node| &node.view else null) == &four_b.view); @@ -349,7 +350,7 @@ test "iteration (View)" { // Reverse iteration over all tags { - var it = ViewStack(View).reverseIterator(views.last, 0xFFFFFFFF); + var it = ViewStack(View).reverseIterator(views.last, std.math.maxInt(u32)); testing.expect((if (it.next()) |node| &node.view else null) == &three_b_pa.view); testing.expect((if (it.next()) |node| &node.view else null) == &one_a_pb.view); testing.expect((if (it.next()) |node| &node.view else null) == &four_b.view); |
