abi: extract_symbols: handle empty lines in whitelist files

Empty lines in existing whitelist files are confusing the symbol sort
mechanism, hence ignore them and return what we got.
Also ignore these empty lines as they are no good anyways.

Bug: 146985684
Change-Id: I6a0101b425d5e7c47515a64fbddf742e7ef3806c
Signed-off-by: Matthias Maennich <maennich@google.com>
diff --git a/abi/extract_symbols b/abi/extract_symbols
index 1676498..8716aa2 100755
--- a/abi/extract_symbols
+++ b/abi/extract_symbols
@@ -36,6 +36,13 @@
     # E.g. __blk_mq_end_request, _blk_mq_end_request, blk_mq_end_request get
     # replaced by blkmqendrequest, blkmqendrequest_, blkmqendrequest__ and
     # compared lexicographically.
+
+    # if the caller passes None or an empty string something is odd, so assert
+    # and ignore if asserts are disabled as we do not need to deal with that
+    assert (a)
+    if not a:
+      return a
+
     tmp = a.lower()
     for idx, c in enumerate(tmp):
       if c != "_":
@@ -111,7 +118,7 @@
   new_wl = []
   if os.path.isfile(whitelist):
     with open(whitelist) as wl:
-      new_wl = [line.strip() for line in wl.readlines()[1:]]
+      new_wl = [line.strip() for line in wl.readlines()[1:] if line.strip()]
 
   new_wl.extend(
       [symbol for symbol in undefined_symbols if symbol in exported_in_vmlinux])