aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-10-20 20:41:20 -0600
committerTom Tromey <tom@tromey.com>2019-10-20 20:54:06 -0600
commit54d83b8d3920eea4a0d545f1ff7ac2923d938e6c (patch)
tree94a1661b2ea78234fb1d6cbe864da97ccda49ac9 /gdb/objfiles.c
parentfd65fe1a180695a3500135bac6d5ed6a70b874de (diff)
downloadgdb-54d83b8d3920eea4a0d545f1ff7ac2923d938e6c.zip
gdb-54d83b8d3920eea4a0d545f1ff7ac2923d938e6c.tar.gz
gdb-54d83b8d3920eea4a0d545f1ff7ac2923d938e6c.tar.bz2
Make unlink_objfile and put_objfile_before static
I noticed an obsolete comment just before unlink_objfile, and then I noticed that both unlink_objfile and put_objfile_before could be static. This patch makes these changes, and also moves unlink_objfile earlier, so that a forward declaration is not needed. Tested by rebuilding. gdb/ChangeLog 2019-10-20 Tom Tromey <tom@tromey.com> * objfiles.h (unlink_objfile, put_objfile_before): Don't declare. * objfiles.c (unlink_objfile): Move earlier. Now static. Remove obsolete comment. (put_objfile_before): Now static. Change-Id: I1b5927a60fd1cc59bfc9c6761f61652a01ef13e0
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c55
1 files changed, 22 insertions, 33 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index f1e708d..fd1cbf7 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -473,10 +473,31 @@ separate_debug_iterator::operator++ ()
return *this;
}
+/* Unlink OBJFILE from the list of known objfiles. */
+
+static void
+unlink_objfile (struct objfile *objfile)
+{
+ struct objfile **objpp;
+
+ for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
+ {
+ if (*objpp == objfile)
+ {
+ *objpp = (*objpp)->next;
+ objfile->next = NULL;
+ return;
+ }
+ }
+
+ internal_error (__FILE__, __LINE__,
+ _("unlink_objfile: objfile already unlinked"));
+}
+
/* Put one object file before a specified on in the global list.
This can be used to make sure an object file is destroyed before
another when using objfiles_safe to free all objfiles. */
-void
+static void
put_objfile_before (struct objfile *objfile, struct objfile *before_this)
{
struct objfile **objp;
@@ -497,38 +518,6 @@ put_objfile_before (struct objfile *objfile, struct objfile *before_this)
_("put_objfile_before: before objfile not in list"));
}
-/* Unlink OBJFILE from the list of known objfiles, if it is found in the
- list.
-
- It is not a bug, or error, to call this function if OBJFILE is not known
- to be in the current list. This is done in the case of mapped objfiles,
- for example, just to ensure that the mapped objfile doesn't appear twice
- in the list. Since the list is threaded, linking in a mapped objfile
- twice would create a circular list.
-
- If OBJFILE turns out to be in the list, we zap it's NEXT pointer after
- unlinking it, just to ensure that we have completely severed any linkages
- between the OBJFILE and the list. */
-
-void
-unlink_objfile (struct objfile *objfile)
-{
- struct objfile **objpp;
-
- for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
- {
- if (*objpp == objfile)
- {
- *objpp = (*objpp)->next;
- objfile->next = NULL;
- return;
- }
- }
-
- internal_error (__FILE__, __LINE__,
- _("unlink_objfile: objfile already unlinked"));
-}
-
/* Add OBJFILE as a separate debug objfile of PARENT. */
void