Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / sim / common / sim-arange.c
index 1238eecc965e929f09e71866475fcfcd9375437a..481b050ec9243aeb48a56d8c9a84c2a1633bf6cd 100644 (file)
@@ -1,38 +1,34 @@
 /* Address ranges.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998-2022 Free Software Foundation, Inc.
    Contributed by Cygnus Solutions.
 
 This file is part of the GNU Simulators.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Tell sim-arange.h it's us.  */
-#define SIM_ARANGE_C
+#ifndef _SIM_ARANGE_C_
+#define _SIM_ARANGE_C_
+
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "libiberty.h"
 #include "sim-basics.h"
-#include "sim-assert.h"
+#include "sim-arange.h"
 
-#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
-#endif
-
-#define DEFINE_INLINE_P (! defined (SIM_ARANGE_C_INCLUDED))
-#define DEFINE_NON_INLINE_P defined (SIM_ARANGE_C_INCLUDED)
-
-#if DEFINE_NON_INLINE_P
+#include <string.h>
 
 /* Insert a range.  */
 
@@ -190,9 +186,9 @@ frob_range (ADDR_RANGE *ar, address_word start, address_word end, int delete_p)
 
  out:
   if (new_asr)
-    free(new_asr);
+    free (new_asr);
   if (new_asr2)
-    free(new_asr2);
+    free (new_asr2);
 }
 
 /* Free T and all subtrees.  */
@@ -251,31 +247,36 @@ build_search_tree (ADDR_RANGE *ar)
   free (asrtab);
 }
 
-void
+INLINE_SIM_ARANGE\
+(void)
 sim_addr_range_add (ADDR_RANGE *ar, address_word start, address_word end)
 {
   frob_range (ar, start, end, 0);
 
   /* Rebuild the search tree.  */
+  /* ??? Instead of rebuilding it here it could be done in a module resume
+     handler, say by first checking for a `changed' flag, assuming of course
+     this would never be done while the simulation is running.  */
   free_search_tree (ar->range_tree);
   build_search_tree (ar);
 }
 
-void
+INLINE_SIM_ARANGE\
+(void)
 sim_addr_range_delete (ADDR_RANGE *ar, address_word start, address_word end)
 {
   frob_range (ar, start, end, 1);
 
   /* Rebuild the search tree.  */
+  /* ??? Instead of rebuilding it here it could be done in a module resume
+     handler, say by first checking for a `changed' flag, assuming of course
+     this would never be done while the simulation is running.  */
   free_search_tree (ar->range_tree);
   build_search_tree (ar);
 }
 
-#endif /* DEFINE_NON_INLINE_P */
-
-#if DEFINE_INLINE_P
-
-SIM_ARANGE_INLINE int
+INLINE_SIM_ARANGE\
+(int)
 sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
 {
   ADDR_RANGE_TREE *t = ar->range_tree;
@@ -292,4 +293,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
   return 0;
 }
 
-#endif /* DEFINE_INLINE_P */
+#endif /* _SIM_ARANGE_C_ */
This page took 0.025318 seconds and 4 git commands to generate.