diff mbox

[edk2,04/47] OvmfPkg/XenBusDxe: guard the definition of ARRAY_SIZE

Message ID 20161026190504.9888-5-lersek@redhat.com
State Superseded
Headers show

Commit Message

Laszlo Ersek Oct. 26, 2016, 7:04 p.m. UTC
In one of the next patches, we'll introduce ARRAY_SIZE in
"MdePkg/Include/Base.h". In order to proceed in small steps, make the
module-local definition of ARRAY_SIZE conditional. This way the
introduction of the macro under MdePkg will silently switch this module
over (after which we can remove the module-local definition completely).

Cc: Gary Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 OvmfPkg/XenBusDxe/XenStore.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.9.2


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Gary Lin Oct. 27, 2016, 3:15 a.m. UTC | #1
On Wed, Oct 26, 2016 at 09:04:21PM +0200, Laszlo Ersek wrote:
> In one of the next patches, we'll introduce ARRAY_SIZE in

> "MdePkg/Include/Base.h". In order to proceed in small steps, make the

> module-local definition of ARRAY_SIZE conditional. This way the

> introduction of the macro under MdePkg will silently switch this module

> over (after which we can remove the module-local definition completely).


It's nice to have a centralized macro.

Reviewed-by: Gary Lin <glin@suse.com>


> 

> Cc: Gary Lin <glin@suse.com>

> Cc: Jordan Justen <jordan.l.justen@intel.com>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

> ---

>  OvmfPkg/XenBusDxe/XenStore.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/OvmfPkg/XenBusDxe/XenStore.c b/OvmfPkg/XenBusDxe/XenStore.c

> index b7ae1d04863d..9eeb6f54fb50 100644

> --- a/OvmfPkg/XenBusDxe/XenStore.c

> +++ b/OvmfPkg/XenBusDxe/XenStore.c

> @@ -713,7 +713,9 @@ static XenStoreErrors gXenStoreErrors[] = {

>    { XENSTORE_STATUS_EISCONN, "EISCONN" },

>    { XENSTORE_STATUS_E2BIG, "E2BIG" }

>  };

> +#ifndef ARRAY_SIZE

>  #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))

> +#endif

>  

>  STATIC

>  XENSTORE_STATUS

> -- 

> 2.9.2

> 

> 

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/OvmfPkg/XenBusDxe/XenStore.c b/OvmfPkg/XenBusDxe/XenStore.c
index b7ae1d04863d..9eeb6f54fb50 100644
--- a/OvmfPkg/XenBusDxe/XenStore.c
+++ b/OvmfPkg/XenBusDxe/XenStore.c
@@ -713,7 +713,9 @@  static XenStoreErrors gXenStoreErrors[] = {
   { XENSTORE_STATUS_EISCONN, "EISCONN" },
   { XENSTORE_STATUS_E2BIG, "E2BIG" }
 };
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+#endif
 
 STATIC
 XENSTORE_STATUS