i965: Simplify annotation_insert_error()
authorMatt Turner <mattst88@gmail.com>
Thu, 16 Nov 2017 21:42:41 +0000 (13:42 -0800)
committerMatt Turner <mattst88@gmail.com>
Fri, 17 Nov 2017 20:14:38 +0000 (12:14 -0800)
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/intel_asm_annotation.c

index b07a545a12ef28d11a9f65fa67c20c42dff3d765..26ab4b981887b9250e05ceadf7dfb011717f5473 100644 (file)
@@ -159,8 +159,6 @@ void
 annotation_insert_error(struct annotation_info *annotation, unsigned offset,
                         const char *error)
 {
-   struct annotation *ann;
-
    if (!annotation->ann_count)
       return;
 
@@ -175,7 +173,6 @@ annotation_insert_error(struct annotation_info *annotation, unsigned offset,
    for (int i = 0; i < annotation->ann_count; i++) {
       struct annotation *cur = &annotation->ann[i];
       struct annotation *next = &annotation->ann[i + 1];
-      ann = cur;
 
       if (next->offset <= offset)
          continue;
@@ -190,11 +187,11 @@ annotation_insert_error(struct annotation_info *annotation, unsigned offset,
          next->block_start = NULL;
          annotation->ann_count++;
       }
-      break;
-   }
 
-   if (ann->error)
-      ralloc_strcat(&ann->error, error);
-   else
-      ann->error = ralloc_strdup(annotation->mem_ctx, error);
+      if (cur->error)
+         ralloc_strcat(&cur->error, error);
+      else
+         cur->error = ralloc_strdup(annotation->mem_ctx, error);
+      return;
+   }
 }