+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Replace explicit sizeof divisions by ARRAY_SIZE.
+
2015-01-19 Kris Moore <kris@pcbsd.org>
* grub-core/disk/geli.c: Support GELI v6 and v7.
{
unsigned i;
- for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
{
if (keysym_table[i].unshifted_name
&& grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
{
unsigned i;
- for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
{
if (keysym_table[i].unshifted_name
&& grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
{
unsigned i;
- for (i = 0; i < sizeof (simple_flag_offsets)
- / sizeof (simple_flag_offsets[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(simple_flag_offsets); i++)
grub_sendkey_set_simple_flag (simple_flag_offsets[i],
grub_sendkey_parse_op(state[i]));
}
/* Set noled. */
- noled = (state[sizeof (simple_flag_offsets)
- / sizeof (simple_flag_offsets[0])].set);
+ noled = (state[ARRAY_SIZE(simple_flag_offsets)].set);
return GRUB_ERR_NONE;
}
{
unsigned int i;
- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE (map); i++)
if (! map[i].drive)
return i;
if (pull != GRUB_DISK_PULL_NONE)
return 0;
- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE (map); i++)
if (map[i].drive && hook (map[i].drive, hook_data))
return 1;
{
unsigned i;
- for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(map); i++)
{
if (map[i].drive)
free (map[i].drive);
for (ptr3 = ptr2; grub_isspace (*ptr3) && *ptr3; ptr3++);
for (ptr4 = ptr3; !grub_isspace (*ptr4) && *ptr4; ptr4++);
for (ptr5 = ptr4; grub_isspace (*ptr5) && *ptr5; ptr5++);
- for (i = 0; i < sizeof (commands) / sizeof (commands[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(commands); i++)
if (grub_strlen (commands[i].name1) == (grub_size_t) (ptr2 - ptr1)
&& grub_strncasecmp (commands[i].name1, ptr1, ptr2 - ptr1) == 0
&& (commands[i].name2 == NULL
&& grub_strncasecmp (commands[i].name2, ptr3, ptr4 - ptr3)
== 0)))
break;
- if (i == sizeof (commands) / sizeof (commands[0]))
+ if (i == ARRAY_SIZE(commands))
{
if (sizeof ("text") - 1 == ptr2 - ptr1
&& grub_strncasecmp ("text", ptr1, ptr2 - ptr1) == 0
*((grub_uint64_t *) curval->data) = (grub_addr_t) ptr;
/* Create alias. */
- for (j = 0; j < sizeof (table_aliases) / sizeof (table_aliases[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(table_aliases); j++)
if (grub_memcmp (&table_aliases[j].guid, &guid, sizeof (guid)) == 0)
break;
- if (j != sizeof (table_aliases) / sizeof (table_aliases[0]))
+ if (j != ARRAY_SIZE(table_aliases))
{
curval = grub_xnu_create_value (&(curkey->first_child), "alias");
if (!curval)
parse_color_name (grub_uint8_t *ret, char *name)
{
grub_uint8_t i;
- for (i = 0; i < sizeof (color_list) / sizeof (*color_list); i++)
+ for (i = 0; i < ARRAY_SIZE(color_list); i++)
if (! grub_strcmp (name, color_list[i]))
{
*ret = i;