]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Move nested functions in dwfl_module_getsrc_file.c.
authorChih-Hung Hsieh <chh@google.com>
Wed, 21 Oct 2015 22:44:56 +0000 (15:44 -0700)
committerMark Wielaard <mjw@redhat.com>
Tue, 3 Nov 2015 22:33:10 +0000 (23:33 +0100)
* Nested functions in this file are moved to file scope
  to compile with clang. Extra parameters are added to pass
  local variables.

Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
libdwfl/ChangeLog
libdwfl/dwfl_module_getsrc_file.c

index e7c373e1fc4ed716523d1116cbe4b51cab377b9d..27250a95443c5e1f713d5adbe9d0eb63d6e47246 100644 (file)
@@ -1,3 +1,11 @@
+2015-10-21  Chih-Hung Hsieh <chh@google.com>
+           Mark Wielaard  <mjw@redhat.com>
+
+       * dwfl_module_getsrc_file.c (dwfl_module_getsrc_file): Move nested
+       functions 'dwarf_line_file', 'dwfl_line', and 'dwfl_line_file' to
+       file scope. Rename dwarf_line_file to dwfl_dwarf_line_file. Don't
+       use INTUSE.
+
 2015-10-21  Chih-Hung Hsieh <chh@google.com>
 
        * frame_unwind.c (expr_eval): Move nested function 'push' and 'pop'
index 20aa8a5fc99553b44feb39803c5c9cadb63e37bb..21a59159248abe8890e4a043dcb7b7e6597d3a86 100644 (file)
 #include "../libdw/libdwP.h"
 
 
+static inline const char *
+dwfl_dwarf_line_file (const Dwarf_Line *line)
+{
+  return line->files->info[line->file].name;
+}
+
+static inline Dwarf_Line *
+dwfl_line (const Dwfl_Line *line)
+{
+  return &dwfl_linecu (line)->die.cu->lines->info[line->idx];
+}
+
+static inline const char *
+dwfl_line_file (const Dwfl_Line *line)
+{
+  return dwfl_dwarf_line_file (dwfl_line (line));
+}
+
 int
 dwfl_module_getsrc_file (Dwfl_Module *mod,
                         const char *fname, int lineno, int column,
@@ -58,19 +76,6 @@ dwfl_module_getsrc_file (Dwfl_Module *mod,
         && cu != NULL
         && (error = __libdwfl_cu_getsrclines (cu)) == DWFL_E_NOERROR)
     {
-      inline const char *INTUSE(dwarf_line_file) (const Dwarf_Line *line)
-       {
-         return line->files->info[line->file].name;
-       }
-      inline Dwarf_Line *dwfl_line (const Dwfl_Line *line)
-       {
-         return &dwfl_linecu (line)->die.cu->lines->info[line->idx];
-       }
-      inline const char *dwfl_line_file (const Dwfl_Line *line)
-       {
-         return INTUSE(dwarf_line_file) (dwfl_line (line));
-       }
-
       /* Search through all the line number records for a matching
         file and line/column number.  If any of the numbers is zero,
         no match is performed.  */
@@ -87,7 +92,7 @@ dwfl_module_getsrc_file (Dwfl_Module *mod,
            }
          else
            {
-             const char *file = INTUSE(dwarf_line_file) (line);
+             const char *file = dwfl_dwarf_line_file (line);
              if (file != lastfile)
                {
                  /* Match the name with the name the user provided.  */
@@ -110,7 +115,7 @@ dwfl_module_getsrc_file (Dwfl_Module *mod,
          size_t inner;
          for (inner = 0; inner < cur_match; ++inner)
            if (dwfl_line_file (match[inner])
-               == INTUSE(dwarf_line_file) (line))
+               == dwfl_dwarf_line_file (line))
              break;
          if (inner < cur_match
              && (dwfl_line (match[inner])->line != line->line