From 56273e92326b26a326c73e47b3d5929bbce9ac03 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 24 Jun 2019 22:48:57 -0700 Subject: [PATCH] Avoid initialization of flexible array in struct --- disk-utils/fdisk-menu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/disk-utils/fdisk-menu.c b/disk-utils/fdisk-menu.c index 71355f684..fb5b2e253 100644 --- a/disk-utils/fdisk-menu.c +++ b/disk-utils/fdisk-menu.c @@ -37,7 +37,7 @@ struct menu { const struct menu *, const struct menu_entry *); - struct menu_entry entries[]; /* NULL terminated array */ + struct menu_entry *entries; /* NULL terminated array */ }; struct menu_context { @@ -92,7 +92,7 @@ DECLARE_MENU_CB(generic_menu_cb); /* Generic menu */ static const struct menu menu_generic = { .callback = generic_menu_cb, - .entries = { + .entries = (struct menu_entry[]){ MENU_BSEP(N_("Generic")), MENU_ENT ('d', N_("delete a partition")), MENU_ENT ('F', N_("list free unpartitioned space")), @@ -134,7 +134,7 @@ static const struct menu menu_createlabel = { .callback = createlabel_menu_cb, .exclude = FDISK_DISKLABEL_BSD, .nonested = 1, - .entries = { + .entries = (struct menu_entry[]){ MENU_SEP(N_("Create a new label")), MENU_ENT('g', N_("create a new empty GPT partition table")), MENU_ENT('G', N_("create a new empty SGI (IRIX) partition table")), @@ -151,7 +151,7 @@ static const struct menu menu_createlabel = { static const struct menu menu_geo = { .callback = geo_menu_cb, .exclude = FDISK_DISKLABEL_GPT | FDISK_DISKLABEL_BSD, - .entries = { + .entries = (struct menu_entry[]){ MENU_XSEP(N_("Geometry (for the current label)")), MENU_XENT('c', N_("change number of cylinders")), MENU_XENT('h', N_("change number of heads")), @@ -163,7 +163,7 @@ static const struct menu menu_geo = { static const struct menu menu_gpt = { .callback = gpt_menu_cb, .label = FDISK_DISKLABEL_GPT, - .entries = { + .entries = (struct menu_entry[]){ MENU_BSEP(N_("GPT")), MENU_XENT('i', N_("change disk GUID")), MENU_XENT('n', N_("change partition name")), @@ -184,7 +184,7 @@ static const struct menu menu_gpt = { static const struct menu menu_sun = { .callback = sun_menu_cb, .label = FDISK_DISKLABEL_SUN, - .entries = { + .entries = (struct menu_entry[]){ MENU_BSEP(N_("Sun")), MENU_ENT('a', N_("toggle the read-only flag")), MENU_ENT('c', N_("toggle the mountable flag")), @@ -201,7 +201,7 @@ static const struct menu menu_sun = { static const struct menu menu_sgi = { .callback = sgi_menu_cb, .label = FDISK_DISKLABEL_SGI, - .entries = { + .entries = (struct menu_entry[]){ MENU_SEP(N_("SGI")), MENU_ENT('a', N_("select bootable partition")), MENU_ENT('b', N_("edit bootfile entry")), @@ -214,7 +214,7 @@ static const struct menu menu_sgi = { static const struct menu menu_dos = { .callback = dos_menu_cb, .label = FDISK_DISKLABEL_DOS, - .entries = { + .entries = (struct menu_entry[]){ MENU_BSEP(N_("DOS (MBR)")), MENU_ENT('a', N_("toggle a bootable flag")), MENU_ENT('b', N_("edit nested BSD disklabel")), @@ -232,7 +232,7 @@ static const struct menu menu_dos = { static const struct menu menu_bsd = { .callback = bsd_menu_cb, .label = FDISK_DISKLABEL_BSD, - .entries = { + .entries = (struct menu_entry[]){ MENU_SEP(N_("BSD")), MENU_ENT('e', N_("edit drive data")), MENU_ENT('i', N_("install bootstrap")), -- 2.25.0