Commit 45ffc864 authored by Max Kellermann's avatar Max Kellermann

util/StringCompare: add more function attributes

parent 19d9ce26
/* /*
* Copyright (C) 2013-2017 Max Kellermann <max.kellermann@gmail.com> * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
......
/* /*
* Copyright (C) 2013-2017 Max Kellermann <max.kellermann@gmail.com> * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "WStringCompare.hxx" #include "WStringCompare.hxx"
#endif #endif
gcc_pure gcc_nonnull_all
static inline bool static inline bool
StringIsEmpty(const char *string) noexcept StringIsEmpty(const char *string) noexcept
{ {
...@@ -51,7 +52,7 @@ StringStartsWith(const char *haystack, StringView needle) noexcept ...@@ -51,7 +52,7 @@ StringStartsWith(const char *haystack, StringView needle) noexcept
return StringIsEqual(haystack, needle.data, needle.size); return StringIsEqual(haystack, needle.data, needle.size);
} }
gcc_pure gcc_pure gcc_nonnull_all
bool bool
StringEndsWith(const char *haystack, const char *needle) noexcept; StringEndsWith(const char *haystack, const char *needle) noexcept;
...@@ -73,7 +74,7 @@ StringAfterPrefix(const char *haystack, StringView needle) noexcept ...@@ -73,7 +74,7 @@ StringAfterPrefix(const char *haystack, StringView needle) noexcept
* Check if the given string ends with the specified suffix. If yes, * Check if the given string ends with the specified suffix. If yes,
* returns the position of the suffix, and nullptr otherwise. * returns the position of the suffix, and nullptr otherwise.
*/ */
gcc_pure gcc_pure gcc_nonnull_all
const char * const char *
FindStringSuffix(const char *p, const char *suffix) noexcept; FindStringSuffix(const char *p, const char *suffix) noexcept;
......
/* /*
* Copyright (C) 2013-2017 Max Kellermann <max.kellermann@gmail.com> * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
......
/* /*
* Copyright (C) 2013-2015 Max Kellermann <max.kellermann@gmail.com> * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <wchar.h> #include <wchar.h>
gcc_pure gcc_nonnull_all
static inline bool static inline bool
StringIsEmpty(const wchar_t *string) noexcept StringIsEmpty(const wchar_t *string) noexcept
{ {
...@@ -49,7 +50,7 @@ StringStartsWith(const wchar_t *haystack, WStringView needle) noexcept ...@@ -49,7 +50,7 @@ StringStartsWith(const wchar_t *haystack, WStringView needle) noexcept
return StringIsEqual(haystack, needle.data, needle.size); return StringIsEqual(haystack, needle.data, needle.size);
} }
gcc_pure gcc_pure gcc_nonnull_all
bool bool
StringEndsWith(const wchar_t *haystack, const wchar_t *needle) noexcept; StringEndsWith(const wchar_t *haystack, const wchar_t *needle) noexcept;
...@@ -71,7 +72,7 @@ StringAfterPrefix(const wchar_t *haystack, WStringView needle) noexcept ...@@ -71,7 +72,7 @@ StringAfterPrefix(const wchar_t *haystack, WStringView needle) noexcept
* Check if the given string ends with the specified suffix. If yes, * Check if the given string ends with the specified suffix. If yes,
* returns the position of the suffix, and nullptr otherwise. * returns the position of the suffix, and nullptr otherwise.
*/ */
gcc_pure gcc_pure gcc_nonnull_all
const wchar_t * const wchar_t *
FindStringSuffix(const wchar_t *p, const wchar_t *suffix) noexcept; FindStringSuffix(const wchar_t *p, const wchar_t *suffix) noexcept;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment