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
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "unicode.h"
|
||||
#include "util.h"
|
||||
|
||||
size_t utf8_chsize(uint32_t ch) {
|
||||
if (ch < 0x80) {
|
||||
|
|
@ -92,7 +93,7 @@ static const struct {
|
|||
|
||||
int utf8_size(const char *s) {
|
||||
uint8_t c = (uint8_t)*s;
|
||||
for (size_t i = 0; i < sizeof(sizes) / sizeof(*sizes); ++i) {
|
||||
for (size_t i = 0; i < ARRAY_SIZE(sizes); ++i) {
|
||||
if ((c & sizes[i].mask) == sizes[i].result) {
|
||||
return sizes[i].octets;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue