summaryrefslogtreecommitdiff
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-05-08 14:44:49 +0200
committerMax Kellermann <max@musicpd.org>2017-05-08 14:44:49 +0200
commit71f0ed8b7499011b53f90998ebfbd3250fd80948 (patch)
treee9c2f66fbef231858f46d878864199d46e6ce21c /src/tag
parentac2e4e593d407e41db49fdb9ae2da6bc1557f618 (diff)
*: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to consider these functions throwing.
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/Format.cxx8
-rw-r--r--src/tag/Format.hxx2
-rw-r--r--src/tag/Id3Load.cxx2
-rw-r--r--src/tag/Settings.hxx4
-rw-r--r--src/tag/Tag.cxx8
-rw-r--r--src/tag/Tag.hxx8
-rw-r--r--src/tag/TagBuilder.cxx6
-rw-r--r--src/tag/TagBuilder.hxx6
-rw-r--r--src/tag/TagId3.cxx4
-rw-r--r--src/tag/TagString.cxx2
-rw-r--r--src/tag/TagTable.cxx6
-rw-r--r--src/tag/TagTable.hxx6
-rw-r--r--src/tag/VorbisComment.cxx2
-rw-r--r--src/tag/VorbisComment.hxx2
14 files changed, 33 insertions, 33 deletions
diff --git a/src/tag/Format.cxx b/src/tag/Format.cxx
index 1164d961c..d70a9c084 100644
--- a/src/tag/Format.cxx
+++ b/src/tag/Format.cxx
@@ -53,7 +53,7 @@ IsUnsafeChar(char ch)
gcc_pure
static bool
-HasUnsafeChar(const char *s)
+HasUnsafeChar(const char *s) noexcept
{
for (; *s; ++s)
if (IsUnsafeChar(*s))
@@ -63,7 +63,7 @@ HasUnsafeChar(const char *s)
}
static const char *
-SanitizeString(const char *s, char *buffer, size_t buffer_size)
+SanitizeString(const char *s, char *buffer, size_t buffer_size) noexcept
{
/* skip leading dots to avoid generating "../" sequences */
while (*s == '.')
@@ -79,7 +79,7 @@ SanitizeString(const char *s, char *buffer, size_t buffer_size)
gcc_pure gcc_nonnull_all
static const char *
-TagGetter(const void *object, const char *name)
+TagGetter(const void *object, const char *name) noexcept
{
const auto &_ctx = *(const FormatTagContext *)object;
auto &ctx = const_cast<FormatTagContext &>(_ctx);
@@ -126,7 +126,7 @@ TagGetter(const void *object, const char *name)
}
char *
-FormatTag(const Tag &tag, const char *format)
+FormatTag(const Tag &tag, const char *format) noexcept
{
FormatTagContext ctx(tag);
return format_object(format, &ctx, TagGetter);
diff --git a/src/tag/Format.hxx b/src/tag/Format.hxx
index cf211e010..3cda2e4f9 100644
--- a/src/tag/Format.hxx
+++ b/src/tag/Format.hxx
@@ -27,6 +27,6 @@ struct Tag;
gcc_malloc gcc_nonnull_all
char *
-FormatTag(const Tag &tag, const char *format);
+FormatTag(const Tag &tag, const char *format) noexcept;
#endif
diff --git a/src/tag/Id3Load.cxx b/src/tag/Id3Load.cxx
index 50be9b76b..fe9ba0b0f 100644
--- a/src/tag/Id3Load.cxx
+++ b/src/tag/Id3Load.cxx
@@ -33,7 +33,7 @@ static constexpr size_t ID3V1_SIZE = 128;
gcc_pure
static inline bool
-tag_is_id3v1(struct id3_tag *tag)
+tag_is_id3v1(struct id3_tag *tag) noexcept
{
return (id3_tag_options(tag, 0, 0) & ID3_TAG_OPTION_ID3V1) != 0;
}
diff --git a/src/tag/Settings.hxx b/src/tag/Settings.hxx
index a6e573cee..be4e9e981 100644
--- a/src/tag/Settings.hxx
+++ b/src/tag/Settings.hxx
@@ -28,14 +28,14 @@ extern tag_mask_t global_tag_mask;
gcc_const
static inline bool
-IsTagEnabled(unsigned tag)
+IsTagEnabled(unsigned tag) noexcept
{
return global_tag_mask & (1u << tag);
}
gcc_const
static inline bool
-IsTagEnabled(TagType tag)
+IsTagEnabled(TagType tag) noexcept
{
return IsTagEnabled(unsigned(tag));
}
diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx
index d2623793b..8efb8df39 100644
--- a/src/tag/Tag.cxx
+++ b/src/tag/Tag.cxx
@@ -27,7 +27,7 @@
#include <string.h>
TagType
-tag_name_parse(const char *name)
+tag_name_parse(const char *name) noexcept
{
assert(name != nullptr);
@@ -42,7 +42,7 @@ tag_name_parse(const char *name)
}
TagType
-tag_name_parse_i(const char *name)
+tag_name_parse_i(const char *name) noexcept
{
assert(name != nullptr);
@@ -112,7 +112,7 @@ Tag::MergeReplace(Tag *base, Tag *add)
}
const char *
-Tag::GetValue(TagType type) const
+Tag::GetValue(TagType type) const noexcept
{
assert(type < TAG_NUM_OF_ITEM_TYPES);
@@ -124,7 +124,7 @@ Tag::GetValue(TagType type) const
}
bool
-Tag::HasType(TagType type) const
+Tag::HasType(TagType type) const noexcept
{
return GetValue(type) != nullptr;
}
diff --git a/src/tag/Tag.hxx b/src/tag/Tag.hxx
index 236793649..33320cf5c 100644
--- a/src/tag/Tag.hxx
+++ b/src/tag/Tag.hxx
@@ -133,14 +133,14 @@ struct Tag {
* nullptr if none is present in this tag object.
*/
gcc_pure
- const char *GetValue(TagType type) const;
+ const char *GetValue(TagType type) const noexcept;
/**
* Checks whether the tag contains one or more items with
* the specified type.
*/
gcc_pure
- bool HasType(TagType type) const;
+ bool HasType(TagType type) const noexcept;
class const_iterator {
friend struct Tag;
@@ -202,7 +202,7 @@ struct Tag {
*/
gcc_pure
TagType
-tag_name_parse(const char *name);
+tag_name_parse(const char *name) noexcept;
/**
* Parse the string, and convert it into a #TagType. Returns
@@ -212,6 +212,6 @@ tag_name_parse(const char *name);
*/
gcc_pure
TagType
-tag_name_parse_i(const char *name);
+tag_name_parse_i(const char *name) noexcept;
#endif
diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx
index 6d259dc54..43cf3cc6f 100644
--- a/src/tag/TagBuilder.cxx
+++ b/src/tag/TagBuilder.cxx
@@ -153,7 +153,7 @@ TagBuilder::CommitNew()
}
bool
-TagBuilder::HasType(TagType type) const
+TagBuilder::HasType(TagType type) const noexcept
{
for (auto i : items)
if (i->type == type)
@@ -237,7 +237,7 @@ TagBuilder::AddEmptyItem(TagType type)
}
void
-TagBuilder::RemoveAll()
+TagBuilder::RemoveAll() noexcept
{
tag_pool_lock.lock();
for (auto i : items)
@@ -248,7 +248,7 @@ TagBuilder::RemoveAll()
}
void
-TagBuilder::RemoveType(TagType type)
+TagBuilder::RemoveType(TagType type) noexcept
{
const auto begin = items.begin(), end = items.end();
diff --git a/src/tag/TagBuilder.hxx b/src/tag/TagBuilder.hxx
index 43b4d71e7..2ec1ae876 100644
--- a/src/tag/TagBuilder.hxx
+++ b/src/tag/TagBuilder.hxx
@@ -124,7 +124,7 @@ public:
* the specified type.
*/
gcc_pure
- bool HasType(TagType type) const;
+ bool HasType(TagType type) const noexcept;
/**
* Copy attributes and items from the other object that do not
@@ -161,12 +161,12 @@ public:
/**
* Removes all tag items.
*/
- void RemoveAll();
+ void RemoveAll() noexcept;
/**
* Removes all tag items of the specified type.
*/
- void RemoveType(TagType type);
+ void RemoveType(TagType type) noexcept;
private:
gcc_nonnull_all
diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx
index f9bf7e9b2..14ce2c392 100644
--- a/src/tag/TagId3.cxx
+++ b/src/tag/TagId3.cxx
@@ -57,7 +57,7 @@
gcc_pure
static id3_utf8_t *
-tag_id3_getstring(const struct id3_frame *frame, unsigned i)
+tag_id3_getstring(const struct id3_frame *frame, unsigned i) noexcept
{
id3_field *field = id3_frame_field(frame, i);
if (field == nullptr)
@@ -203,7 +203,7 @@ tag_id3_import_comment(struct id3_tag *tag, const char *id, TagType type,
*/
gcc_pure
static TagType
-tag_id3_parse_txxx_name(const char *name)
+tag_id3_parse_txxx_name(const char *name) noexcept
{
static constexpr struct tag_table txxx_tags[] = {
{ "ALBUMARTISTSORT", TAG_ALBUM_ARTIST_SORT },
diff --git a/src/tag/TagString.cxx b/src/tag/TagString.cxx
index 8462c1fa1..1c37bf422 100644
--- a/src/tag/TagString.cxx
+++ b/src/tag/TagString.cxx
@@ -29,7 +29,7 @@
gcc_pure
static const char *
-FindInvalidUTF8(const char *p, const char *const end)
+FindInvalidUTF8(const char *p, const char *const end) noexcept
{
while (p < end) {
const size_t s = SequenceLengthUTF8(*p);
diff --git a/src/tag/TagTable.cxx b/src/tag/TagTable.cxx
index 74ef03521..9953c011a 100644
--- a/src/tag/TagTable.cxx
+++ b/src/tag/TagTable.cxx
@@ -28,7 +28,7 @@
* in the table.
*/
TagType
-tag_table_lookup(const struct tag_table *table, const char *name)
+tag_table_lookup(const struct tag_table *table, const char *name) noexcept
{
for (; table->name != nullptr; ++table)
if (strcmp(name, table->name) == 0)
@@ -43,7 +43,7 @@ tag_table_lookup(const struct tag_table *table, const char *name)
* in the table.
*/
TagType
-tag_table_lookup_i(const struct tag_table *table, const char *name)
+tag_table_lookup_i(const struct tag_table *table, const char *name) noexcept
{
for (; table->name != nullptr; ++table)
if (StringEqualsCaseASCII(name, table->name))
@@ -53,7 +53,7 @@ tag_table_lookup_i(const struct tag_table *table, const char *name)
}
const char *
-tag_table_lookup(const tag_table *table, TagType type)
+tag_table_lookup(const tag_table *table, TagType type) noexcept
{
for (; table->name != nullptr; ++table)
if (table->type == type)
diff --git a/src/tag/TagTable.hxx b/src/tag/TagTable.hxx
index 3591fbb1d..c3357df5e 100644
--- a/src/tag/TagTable.hxx
+++ b/src/tag/TagTable.hxx
@@ -36,7 +36,7 @@ struct tag_table {
*/
gcc_pure
TagType
-tag_table_lookup(const tag_table *table, const char *name);
+tag_table_lookup(const tag_table *table, const char *name) noexcept;
/**
* Looks up a string in a tag translation table (case insensitive).
@@ -45,7 +45,7 @@ tag_table_lookup(const tag_table *table, const char *name);
*/
gcc_pure
TagType
-tag_table_lookup_i(const tag_table *table, const char *name);
+tag_table_lookup_i(const tag_table *table, const char *name) noexcept;
/**
* Looks up a #TagType in a tag translation table and returns its
@@ -54,6 +54,6 @@ tag_table_lookup_i(const tag_table *table, const char *name);
*/
gcc_pure
const char *
-tag_table_lookup(const tag_table *table, TagType type);
+tag_table_lookup(const tag_table *table, TagType type) noexcept;
#endif
diff --git a/src/tag/VorbisComment.cxx b/src/tag/VorbisComment.cxx
index f29cb80ae..c312c9f18 100644
--- a/src/tag/VorbisComment.cxx
+++ b/src/tag/VorbisComment.cxx
@@ -25,7 +25,7 @@
#include <string.h>
const char *
-vorbis_comment_value(const char *entry, const char *name)
+vorbis_comment_value(const char *entry, const char *name) noexcept
{
assert(entry != nullptr);
assert(name != nullptr);
diff --git a/src/tag/VorbisComment.hxx b/src/tag/VorbisComment.hxx
index f8635c8e1..d2ea86338 100644
--- a/src/tag/VorbisComment.hxx
+++ b/src/tag/VorbisComment.hxx
@@ -29,6 +29,6 @@
*/
gcc_pure
const char *
-vorbis_comment_value(const char *entry, const char *name);
+vorbis_comment_value(const char *entry, const char *name) noexcept;
#endif