Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
05f529ff
Commit
05f529ff
authored
Nov 26, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringStrip: use [[gnu::...]] attributes
parent
f0138855
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
28 deletions
+24
-28
LogBackend.cxx
src/LogBackend.cxx
+2
-1
StringStrip.cxx
src/util/StringStrip.cxx
+1
-1
StringStrip.hxx
src/util/StringStrip.hxx
+9
-11
UTF8.cxx
src/util/UTF8.cxx
+5
-5
UTF8.hxx
src/util/UTF8.hxx
+7
-10
No files found.
src/LogBackend.cxx
View file @
05f529ff
...
...
@@ -19,6 +19,7 @@
#include "LogBackend.hxx"
#include "Log.hxx"
#include "util/Compiler.h"
#include "util/Domain.hxx"
#include "util/StringStrip.hxx"
#include "Version.h"
...
...
@@ -110,7 +111,7 @@ chomp_length(std::string_view p) noexcept
#ifdef HAVE_SYSLOG
gcc_const
[[
gnu
::
const
]]
static
int
ToSysLogLevel
(
LogLevel
log_level
)
noexcept
{
...
...
src/util/StringStrip.cxx
View file @
05f529ff
/*
* Copyright 2009-202
0
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2009-202
1
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
...
...
src/util/StringStrip.hxx
View file @
05f529ff
/*
* Copyright 2009-202
0
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2009-202
1
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
...
...
@@ -30,8 +30,6 @@
#ifndef STRING_STRIP_HXX
#define STRING_STRIP_HXX
#include "Compiler.h"
#include <cstddef>
/**
...
...
@@ -40,11 +38,11 @@
* non-whitespace characters, then a pointer to the NULL terminator is
* returned.
*/
gcc_pure
gcc_returns_nonnull
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
returns_nonnull
]]
[[
gnu
::
nonnull
]]
const
char
*
StripLeft
(
const
char
*
p
)
noexcept
;
gcc_pure
gcc_returns_nonnull
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
returns_nonnull
]]
[[
gnu
::
nonnull
]]
static
inline
char
*
StripLeft
(
char
*
p
)
noexcept
{
...
...
@@ -55,21 +53,21 @@ StripLeft(char *p) noexcept
* Skips whitespace at the beginning of the string, and returns the
* first non-whitespace character or the end pointer.
*/
gcc_pure
gcc_returns_nonnull
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
returns_nonnull
]]
[[
gnu
::
nonnull
]]
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_returns_nonnull
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
returns_nonnull
]]
[[
gnu
::
nonnull
]]
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_returns_nonnull
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
returns_nonnull
]]
[[
gnu
::
nonnull
]]
static
inline
char
*
StripRight
(
char
*
p
,
char
*
end
)
noexcept
{
...
...
@@ -81,14 +79,14 @@ StripRight(char *p, char *end) noexcept
* Determine the string's length as if it was stripped on the right
* side.
*/
gcc_pure
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
nonnull
]]
std
::
size_t
StripRight
(
const
char
*
p
,
std
::
size_t
length
)
noexcept
;
/**
* Strip trailing whitespace by null-terminating the string.
*/
gcc_nonnull_all
[[
gnu
::
nonnull
]]
void
StripRight
(
char
*
p
)
noexcept
;
...
...
@@ -96,7 +94,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
[[
gnu
::
returns_nonnull
]]
[[
gnu
::
nonnull
]]
char
*
Strip
(
char
*
p
)
noexcept
;
...
...
src/util/UTF8.cxx
View file @
05f529ff
/*
* Copyright 2011-2019 Max Kellermann <max.kellermann@gmail.com>
* http://www.musicpd.org
* Copyright 2011-2021 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
...
...
@@ -30,6 +29,7 @@
#include "UTF8.hxx"
#include "CharUtil.hxx"
#include "Compiler.h"
#include <algorithm>
#include <cstdint>
...
...
@@ -196,7 +196,7 @@ SequenceLengthUTF8(char ch) noexcept
template
<
std
::
size_t
L
>
struct
CheckSequenceUTF8
{
gcc_pure
[[
gnu
::
pure
]]
bool
operator
()(
const
char
*
p
)
const
noexcept
{
return
IsContinuation
(
*
p
)
&&
CheckSequenceUTF8
<
L
-
1
>
()(
p
+
1
);
}
...
...
@@ -210,7 +210,7 @@ struct CheckSequenceUTF8<0U> {
};
template
<
std
::
size_t
L
>
gcc_pure
[[
gnu
::
pure
]]
static
std
::
size_t
InnerSequenceLengthUTF8
(
const
char
*
p
)
noexcept
{
...
...
@@ -247,7 +247,7 @@ SequenceLengthUTF8(const char *p) noexcept
return
0
;
}
gcc_pure
[[
gnu
::
pure
]]
static
const
char
*
FindNonASCIIOrZero
(
const
char
*
p
)
noexcept
{
...
...
src/util/UTF8.hxx
View file @
05f529ff
/*
* Copyright 2011-2019 Max Kellermann <max.kellermann@gmail.com>
* http://www.musicpd.org
* Copyright 2011-2021 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
...
...
@@ -31,14 +30,12 @@
#ifndef UTF8_HXX
#define UTF8_HXX
#include "Compiler.h"
#include <cstddef>
/**
* Is this a valid UTF-8 string?
*/
gcc_pure
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
nonnull
]]
bool
ValidateUTF8
(
const
char
*
p
)
noexcept
;
...
...
@@ -46,7 +43,7 @@ ValidateUTF8(const char *p) noexcept;
* @return the number of the sequence beginning with the given
* character, or 0 if the character is not a valid start byte
*/
gcc_const
[[
gnu
::
const
]]
std
::
size_t
SequenceLengthUTF8
(
char
ch
)
noexcept
;
...
...
@@ -54,7 +51,7 @@ SequenceLengthUTF8(char ch) noexcept;
* @return the number of the first sequence in the given string, or 0
* if the sequence is malformed
*/
gcc_pure
[[
gnu
::
pure
]]
std
::
size_t
SequenceLengthUTF8
(
const
char
*
p
)
noexcept
;
...
...
@@ -65,7 +62,7 @@ SequenceLengthUTF8(const char *p) noexcept;
* there are no non-ASCII characters; returns nullptr if the destination
* buffer is too small
*/
gcc_pure
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
nonnull
]]
const
char
*
Latin1ToUTF8
(
const
char
*
src
,
char
*
buffer
,
std
::
size_t
buffer_size
)
noexcept
;
...
...
@@ -75,7 +72,7 @@ Latin1ToUTF8(const char *src, char *buffer, std::size_t buffer_size) noexcept;
*
* @return a pointer to the buffer plus the added bytes(s)
*/
gcc_nonnull_all
[[
gnu
::
nonnull
]]
char
*
UnicodeToUTF8
(
unsigned
ch
,
char
*
buffer
)
noexcept
;
...
...
@@ -83,7 +80,7 @@ UnicodeToUTF8(unsigned ch, char *buffer) noexcept;
* Returns the number of characters in the string. This is different
* from strlen(), which counts the number of bytes.
*/
gcc_pure
gcc_nonnull_all
[[
gnu
::
pure
]]
[[
gnu
::
nonnull
]]
std
::
size_t
LengthUTF8
(
const
char
*
p
)
noexcept
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment