mirror of
https://github.com/swaywm/sway.git
synced 2026-04-30 06:46:24 -04:00
use standard ARRAY_SIZE() macro
Replace all the custom `sizeof(array)/sizeof(element)` and `sizeof(array)/sizeof(type)` with the standard macro ARRAY_SIZE().
This commit is contained in:
parent
5f8676f214
commit
021933f735
14 changed files with 33 additions and 23 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include <wlr/util/log.h>
|
||||
#include "swaybar/config.h"
|
||||
#include "swaybar/status_line.h"
|
||||
#include "util.h"
|
||||
|
||||
void i3bar_block_free(struct i3bar_block *block) {
|
||||
if (!block) {
|
||||
|
|
@ -146,8 +147,7 @@ bool i3bar_handle_readable(struct status_line *status) {
|
|||
switch (*cur) {
|
||||
case '[':
|
||||
++state->depth;
|
||||
if (state->depth >
|
||||
sizeof(state->nodes) / sizeof(state->nodes[0])) {
|
||||
if (state->depth > ARRAY_SIZE(state->nodes)) {
|
||||
status_error(status, "[i3bar json too deep]");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -177,8 +177,7 @@ bool i3bar_handle_readable(struct status_line *status) {
|
|||
break;
|
||||
case '"':
|
||||
++state->depth;
|
||||
if (state->depth >
|
||||
sizeof(state->nodes) / sizeof(state->nodes[0])) {
|
||||
if (state->depth > ARRAY_SIZE(state->nodes)) {
|
||||
status_error(status, "[i3bar json too deep]");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue