util/StringCompare: add more function attributes

This commit is contained in:
Max Kellermann 2018-09-06 19:23:13 +02:00
parent 19d9ce260a
commit 45ffc864c5
4 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* 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
* modification, are permitted provided that the following conditions

View File

@ -1,5 +1,5 @@
/*
* 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
* modification, are permitted provided that the following conditions
@ -38,6 +38,7 @@
#include "WStringCompare.hxx"
#endif
gcc_pure gcc_nonnull_all
static inline bool
StringIsEmpty(const char *string) noexcept
{
@ -51,7 +52,7 @@ StringStartsWith(const char *haystack, StringView needle) noexcept
return StringIsEqual(haystack, needle.data, needle.size);
}
gcc_pure
gcc_pure gcc_nonnull_all
bool
StringEndsWith(const char *haystack, const char *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,
* returns the position of the suffix, and nullptr otherwise.
*/
gcc_pure
gcc_pure gcc_nonnull_all
const char *
FindStringSuffix(const char *p, const char *suffix) noexcept;

View File

@ -1,5 +1,5 @@
/*
* 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
* modification, are permitted provided that the following conditions

View File

@ -1,5 +1,5 @@
/*
* 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
* modification, are permitted provided that the following conditions
@ -36,6 +36,7 @@
#include <wchar.h>
gcc_pure gcc_nonnull_all
static inline bool
StringIsEmpty(const wchar_t *string) noexcept
{
@ -49,7 +50,7 @@ StringStartsWith(const wchar_t *haystack, WStringView needle) noexcept
return StringIsEqual(haystack, needle.data, needle.size);
}
gcc_pure
gcc_pure gcc_nonnull_all
bool
StringEndsWith(const wchar_t *haystack, const wchar_t *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,
* returns the position of the suffix, and nullptr otherwise.
*/
gcc_pure
gcc_pure gcc_nonnull_all
const wchar_t *
FindStringSuffix(const wchar_t *p, const wchar_t *suffix) noexcept;