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:
Eric Engestrom 2018-07-30 14:29:34 +01:00
parent 5f8676f214
commit 021933f735
14 changed files with 33 additions and 23 deletions

View file

@ -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;
}