[Mesa-dev] [PATCH 06/33] intel: decoder: move field name copy

Lionel Landwerlin lionel.g.landwerlin at intel.com
Mon Oct 30 16:58:19 UTC 2017


This should be inside the function that actually decodes fields.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 src/intel/common/gen_decoder.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index ef39c1c14db..8336269b183 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -822,10 +822,6 @@ iter_advance_field(struct gen_field_iterator *iter)
    }
 
    iter->field = iter->field->next;
-   if (iter->field->name)
-       strncpy(iter->name, iter->field->name, sizeof(iter->name));
-   else
-      memset(iter->name, 0, sizeof(iter->name));
    iter->dword = iter_group_offset_bits(iter, iter->group_iter) / 32 +
       iter->field->start / 32;
    iter->struct_desc = NULL;
@@ -844,6 +840,11 @@ gen_field_iterator_next(struct gen_field_iterator *iter)
    if (!iter_advance_field(iter))
       return false;
 
+   if (iter->field->name)
+      strncpy(iter->name, iter->field->name, sizeof(iter->name));
+   else
+      memset(iter->name, 0, sizeof(iter->name));
+
    if ((iter->field->end - iter->field->start) > 32)
       v.qw = ((uint64_t) iter->p[iter->dword+1] << 32) | iter->p[iter->dword];
    else
-- 
2.15.0.rc2



More information about the mesa-dev mailing list