From 56f15ca6c6be5b5d853ff327db69e625597caf74 Mon Sep 17 00:00:00 2001 From: Costa Shulyupin Date: Thu, 19 Jul 2018 12:54:11 +0300 Subject: [PATCH] use set --- srcxray.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/srcxray.py b/srcxray.py index e168f9c..0a038ee 100755 --- a/srcxray.py +++ b/srcxray.py @@ -73,7 +73,7 @@ def extract_referer_test(): def func_referers_git_grep(name): - res = [] + res = set() r = None for line in popen(r'git grep --no-index --word-regexp --show-function ' r'"^\s.*\b%s"' % (name)): @@ -89,7 +89,7 @@ def func_referers_git_grep(name): r = None break if r and r != name and r not in black_list: - res.append(r) + res.add(r) r = None r = extract_referer(line) return res @@ -105,8 +105,8 @@ def func_referers_cscope(name): print("Recommended: cscope -bkR", file=sys.stderr) cscope_warned = True return [] - res = [l.split()[1] for l in popen(r'cscope -d -L3 "%s"' % - (name)) if l not in black_list] + res = set([l.split()[1] for l in popen(r'cscope -d -L3 "%s"' % + (name)) if l not in black_list]) if not res: res = func_referers_git_grep(name) return res