diff options
Diffstat (limited to 'gdbsupport/common-utils.h')
-rw-r--r-- | gdbsupport/common-utils.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h index 97dcb9f..b171c3b 100644 --- a/gdbsupport/common-utils.h +++ b/gdbsupport/common-utils.h @@ -28,9 +28,9 @@ #include "gdb_string_view.h" #if defined HAVE_LIBXXHASH -# include <xxhash.h> +#include <xxhash.h> #else -# include "hashtab.h" +#include "hashtab.h" #endif /* xmalloc(), xrealloc() and xcalloc() have already been declared in @@ -42,29 +42,28 @@ void *xzalloc (size_t); /* Like asprintf and vasprintf, but return the string, throw an error if no memory. */ gdb::unique_xmalloc_ptr<char> xstrprintf (const char *format, ...) - ATTRIBUTE_PRINTF (1, 2); + ATTRIBUTE_PRINTF (1, 2); gdb::unique_xmalloc_ptr<char> xstrvprintf (const char *format, va_list ap) - ATTRIBUTE_PRINTF (1, 0); + ATTRIBUTE_PRINTF (1, 0); /* Like snprintf, but throw an error if the output buffer is too small. */ int xsnprintf (char *str, size_t size, const char *format, ...) - ATTRIBUTE_PRINTF (3, 4); + ATTRIBUTE_PRINTF (3, 4); /* Returns a std::string built from a printf-style format string. */ -std::string string_printf (const char* fmt, ...) - ATTRIBUTE_PRINTF (1, 2); +std::string string_printf (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2); /* Like string_printf, but takes a va_list. */ -std::string string_vprintf (const char* fmt, va_list args) +std::string string_vprintf (const char *fmt, va_list args) ATTRIBUTE_PRINTF (1, 0); /* Like string_printf, but appends to DEST instead of returning a new std::string. */ -std::string &string_appendf (std::string &dest, const char* fmt, ...) +std::string &string_appendf (std::string &dest, const char *fmt, ...) ATTRIBUTE_PRINTF (2, 3); /* Like string_appendf, but takes a va_list. */ -std::string &string_vappendf (std::string &dest, const char* fmt, va_list args) +std::string &string_vappendf (std::string &dest, const char *fmt, va_list args) ATTRIBUTE_PRINTF (2, 0); /* Make a copy of the string at PTR with LEN characters @@ -96,7 +95,8 @@ static inline bool startswith (gdb::string_view string, gdb::string_view pattern) { return (string.length () >= pattern.length () - && strncmp (string.data (), pattern.data (), pattern.length ()) == 0); + && strncmp (string.data (), pattern.data (), pattern.length ()) + == 0); } /* Return true if the strings are equal. */ @@ -141,7 +141,7 @@ extern void free_vector_argv (std::vector<char *> &v); /* Return true if VALUE is in [LOW, HIGH]. */ -template <typename T> +template<typename T> static bool in_inclusive_range (T value, T low, T high) { @@ -221,7 +221,9 @@ namespace gdb struct string_view_hash { std::size_t operator() (gdb::string_view view) const - { return fast_hash (view.data (), view.length ()); } + { + return fast_hash (view.data (), view.length ()); + } }; } /* namespace gdb */ |