[Mesa-dev] [PATCH mesa 5/6] targets/nine: use ARRAY_SIZE macro
Eric Engestrom
eric.engestrom at imgtec.com
Thu Sep 7 10:21:16 UTC 2017
Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
src/gallium/targets/d3dadapter9/description.c | 9 +++++----
src/gallium/targets/d3dadapter9/drm.c | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/gallium/targets/d3dadapter9/description.c b/src/gallium/targets/d3dadapter9/description.c
index c0a86782f8..b82a841b41 100644
--- a/src/gallium/targets/d3dadapter9/description.c
+++ b/src/gallium/targets/d3dadapter9/description.c
@@ -22,6 +22,7 @@
#include <string.h>
#include "adapter9.h"
+#include "util/macros.h"
#define DBG_CHANNEL DBG_ADAPTER
@@ -275,7 +276,7 @@ void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid) {
unsigned i;
switch (drvid->VendorId) {
case HW_VENDOR_INTEL:
- for (i = 0; i < sizeof(cards_intel) / sizeof(cards_intel[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(cards_intel); i++) {
if (strstr(drvid->Description, cards_intel[i].mesaname)) {
strncpy(drvid->Description, cards_intel[i].d3d9name, sizeof(drvid->Description));
return;
@@ -286,7 +287,7 @@ void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid) {
strncpy(drvid->Description, cards_intel[0].d3d9name, sizeof(drvid->Description));
break;
case HW_VENDOR_VMWARE:
- for (i = 0; i < sizeof(cards_vmware) / sizeof(cards_vmware[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(cards_vmware); i++) {
if (strstr(drvid->Description, cards_vmware[i].mesaname)) {
strncpy(drvid->Description, cards_vmware[i].d3d9name, sizeof(drvid->Description));
return;
@@ -297,7 +298,7 @@ void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid) {
strncpy(drvid->Description, cards_vmware[0].d3d9name, sizeof(drvid->Description));
break;
case HW_VENDOR_AMD:
- for (i = 0; i < sizeof(cards_amd) / sizeof(cards_amd[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(cards_amd); i++) {
if (strstr(drvid->Description, cards_amd[i].mesaname)) {
strncpy(drvid->Description, cards_amd[i].d3d9name, sizeof(drvid->Description));
return;
@@ -308,7 +309,7 @@ void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid) {
strncpy(drvid->Description, cards_amd[0].d3d9name, sizeof(drvid->Description));
break;
case HW_VENDOR_NVIDIA:
- for (i = 0; i < sizeof(cards_nvidia) / sizeof(cards_nvidia[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(cards_nvidia); i++) {
if (strstr(drvid->Description, cards_nvidia[i].mesaname)) {
strncpy(drvid->Description, cards_nvidia[i].d3d9name, sizeof(drvid->Description));
return;
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index 9c5bd8a15b..88e174bcdb 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -37,6 +37,7 @@
#include "d3dadapter/d3dadapter9.h"
#include "d3dadapter/drm.h"
+#include "util/macros.h"
#include "util/xmlconfig.h"
#include "util/xmlpool.h"
@@ -155,7 +156,7 @@ read_descriptor( struct d3dadapter9_context *ctx,
if (override_vendorid > 0) {
found = FALSE;
/* fill in device_id and card name for fake vendor */
- for (i = 0; i < sizeof(fallback_cards)/sizeof(fallback_cards[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(fallback_cards); i++) {
if (fallback_cards[i].vendor_id == override_vendorid) {
DBG("Faking card '%s' vendor 0x%04x, device 0x%04x\n",
fallback_cards[i].name,
--
Cheers,
Eric
More information about the mesa-dev
mailing list