mirror of
https://github.com/swaywm/sway.git
synced 2026-04-29 06:46:22 -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
|
|
@ -14,6 +14,7 @@
|
|||
#include "ipc-client.h"
|
||||
#include "readline.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
void sway_terminate(int exit_code) {
|
||||
exit(exit_code);
|
||||
|
|
@ -101,7 +102,7 @@ static const char *pretty_type_name(const char *name) {
|
|||
{ "touch", "Touch" },
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(type_names) / sizeof(type_names[0]); ++i) {
|
||||
for (size_t i = 0; i < ARRAY_SIZE(type_names); ++i) {
|
||||
if (strcmp(type_names[i].a, name) == 0) {
|
||||
return type_names[i].b;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue