From 23952b5ce002a97c040bbb151f9371a046c955f4 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Fri, 3 Mar 2017 17:06:16 -0600 Subject: [PATCH] lookup: minor lookup_open() cleanup A couple of minor cleanups: - move the `if (locals)` check to find_local_syms() - remove the explicit initialization of `local_syms`, the entire struct was already previously cleared to zero. --- kpatch-build/lookup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c index 47f28d8..c65f29f 100644 --- a/kpatch-build/lookup.c +++ b/kpatch-build/lookup.c @@ -84,6 +84,9 @@ static void find_local_syms(struct lookup_table *table, char *hint, int i, in_file = 0; struct sym_compare_type *child_sym; + if (!child_locals) + return; + for_each_obj_symbol(i, sym, table) { if (sym->type == STT_FILE) { if (in_file && !child_sym->name) { @@ -287,10 +290,7 @@ struct lookup_table *lookup_open(char *obj_path, char *symvers_path, obj_read(table, obj_path); symvers_read(table, symvers_path); - - table->local_syms = NULL; - if (locals) - find_local_syms(table, hint, locals); + find_local_syms(table, hint, locals); return table; }