util/StringStrip: add more "nonnull" attributes
This commit is contained in:
parent
ec54754e22
commit
441440101d
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2009-2017 Max Kellermann <max.kellermann@gmail.com>
|
||||
* Copyright 2009-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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2009-2017 Max Kellermann <max.kellermann@gmail.com>
|
||||
* Copyright 2009-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,32 +38,32 @@
|
||||
* Returns a pointer to the first non-whitespace character in the
|
||||
* string, or to the end of the string.
|
||||
*/
|
||||
gcc_pure
|
||||
gcc_pure gcc_returns_nonnull gcc_nonnull_all
|
||||
const char *
|
||||
StripLeft(const char *p) noexcept;
|
||||
|
||||
gcc_pure
|
||||
gcc_pure gcc_returns_nonnull gcc_nonnull_all
|
||||
static inline char *
|
||||
StripLeft(char *p) noexcept
|
||||
{
|
||||
return const_cast<char *>(StripLeft((const char *)p));
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
gcc_pure gcc_returns_nonnull gcc_nonnull_all
|
||||
const char *
|
||||
StripLeft(const char *p, const char *end) noexcept;
|
||||
|
||||
/**
|
||||
* Determine the string's end as if it was stripped on the right side.
|
||||
*/
|
||||
gcc_pure
|
||||
gcc_pure gcc_returns_nonnull gcc_nonnull_all
|
||||
const char *
|
||||
StripRight(const char *p, const char *end) noexcept;
|
||||
|
||||
/**
|
||||
* Determine the string's end as if it was stripped on the right side.
|
||||
*/
|
||||
gcc_pure
|
||||
gcc_pure gcc_returns_nonnull gcc_nonnull_all
|
||||
static inline char *
|
||||
StripRight(char *p, char *end) noexcept
|
||||
{
|
||||
@ -75,13 +75,14 @@ StripRight(char *p, char *end) noexcept
|
||||
* Determine the string's length as if it was stripped on the right
|
||||
* side.
|
||||
*/
|
||||
gcc_pure
|
||||
gcc_pure gcc_nonnull_all
|
||||
size_t
|
||||
StripRight(const char *p, size_t length) noexcept;
|
||||
|
||||
/**
|
||||
* Strip trailing whitespace by null-terminating the string.
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
void
|
||||
StripRight(char *p) noexcept;
|
||||
|
||||
@ -89,6 +90,7 @@ StripRight(char *p) noexcept;
|
||||
* Skip whitespace at the beginning and terminate the string after the
|
||||
* last non-whitespace character.
|
||||
*/
|
||||
gcc_returns_nonnull gcc_nonnull_all
|
||||
char *
|
||||
Strip(char *p) noexcept;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user