tools lib: Adopt zalloc()/zfree() from tools/perf
[platform/kernel/linux-starfive.git] / tools / perf / ui / browsers / annotate.c
index 98d934a..e67880b 100644 (file)
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "../../util/util.h"
 #include "../browser.h"
 #include "../helpline.h"
 #include "../ui.h"
@@ -15,6 +14,7 @@
 #include <pthread.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
+#include <linux/zalloc.h>
 #include <sys/ttydefaults.h>
 #include <asm/bug.h>
 
@@ -97,11 +97,12 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
        struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);
        struct annotation *notes = browser__annotation(browser);
        struct annotation_line *al = list_entry(entry, struct annotation_line, node);
+       const bool is_current_entry = ui_browser__is_current_entry(browser, row);
        struct annotation_write_ops ops = {
                .first_line              = row == 0,
-               .current_entry           = ui_browser__is_current_entry(browser, row),
+               .current_entry           = is_current_entry,
                .change_color            = (!notes->options->hide_src_code &&
-                                           (!ops.current_entry ||
+                                           (!is_current_entry ||
                                             (browser->use_navkeypressed &&
                                              !browser->navkeypressed))),
                .width                   = browser->width,