Add support for reading msdos MZ executables.
[deliverable/binutils-gdb.git] / gdb / common / common-utils.h
index a32863c02fe75a524372978112137bd1cc535697..2320318de74d6b08ea49b2b9d2f9f138fed346dd 100644 (file)
@@ -1,6 +1,6 @@
 /* Shared general utility routines for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2017 Free Software Foundation, Inc.
+   Copyright (C) 1986-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,6 +23,8 @@
 #include <string>
 #include <vector>
 
+#include "poison.h"
+
 /* If possible, define FUNCTION_NAME, a macro containing the name of
    the function being defined.  Since this macro may not always be
    defined, all uses must be protected by appropriate macro definition
 /* Like xmalloc, but zero the memory.  */
 void *xzalloc (size_t);
 
-void xfree (void *);
+template <typename T>
+static void
+xfree (T *ptr)
+{
+  static_assert (IsFreeable<T>::value, "Trying to use xfree with a non-POD \
+data type.  Use operator delete instead.");
+
+  if (ptr != NULL)
+    free (ptr);                /* ARI: free */
+}
+
 
 /* Like asprintf and vasprintf, but return the string, throw an error
    if no memory.  */
@@ -125,4 +137,13 @@ extern void free_vector_argv (std::vector<char *> &v);
    joining all the arguments with a whitespace separating them.  */
 extern std::string stringify_argv (const std::vector<char *> &argv);
 
+/* Return true if VALUE is in [LOW, HIGH].  */
+
+template <typename T>
+static bool
+in_inclusive_range (T value, T low, T high)
+{
+  return value >= low && value <= high;
+}
+
 #endif
This page took 0.025271 seconds and 4 git commands to generate.