Replace explicit sizeof divisions by ARRAY_SIZE.

This commit is contained in:
Vladimir Serbinenko 2015-01-20 12:45:45 +01:00
parent ba3031f996
commit 59d4036594
6 changed files with 16 additions and 14 deletions

View file

@ -717,7 +717,7 @@ syslinux_parse_real (struct syslinux_menu *menu)
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
@ -726,7 +726,7 @@ syslinux_parse_real (struct syslinux_menu *menu)
&& 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