diff options
author | David Robillard <d@drobilla.net> | 2024-09-27 13:06:13 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-09-27 18:15:35 -0400 |
commit | 771215229522e203eba802bc041a1d8105de9283 (patch) | |
tree | 57e45558c47792b610649bb734dfd3f545e09688 | |
parent | a4acf0c7414451d22b6264f2fabfa5eb348fbb62 (diff) | |
download | serd-771215229522e203eba802bc041a1d8105de9283.tar.gz serd-771215229522e203eba802bc041a1d8105de9283.tar.bz2 serd-771215229522e203eba802bc041a1d8105de9283.zip |
Clean up and update clang-format configuration
Fix "SERD_CONST_FINC" typo, add the other function attributes, and sort all
fields.
-rw-r--r-- | .clang-format | 30 | ||||
-rw-r--r-- | include/serd/serd.h | 15 | ||||
-rw-r--r-- | test/headers/test_headers.c | 3 |
3 files changed, 22 insertions, 26 deletions
diff --git a/.clang-format b/.clang-format index 26b10123..1ec52448 100644 --- a/.clang-format +++ b/.clang-format @@ -1,17 +1,29 @@ -# Copyright 2020-2023 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC --- AlignConsecutiveAssignments: true AlignConsecutiveDeclarations: true -AlignEscapedNewlinesLeft: true +AlignEscapedNewlines: Left +AttributeMacros: + - SERD_ALLOCATED + - SERD_API + - SERD_CONST_API + - SERD_CONST_FUNC + - SERD_FALLTHROUGH + - SERD_MALLOC_FUNC + - SERD_NODISCARD + - SERD_NONNULL + - SERD_NULLABLE + - SERD_PURE_API + - SERD_PURE_FUNC BasedOnStyle: Mozilla BraceWrapping: - AfterNamespace: false AfterClass: true AfterEnum: false AfterExternBlock: false AfterFunction: true + AfterNamespace: false AfterStruct: false SplitEmptyFunction: false SplitEmptyRecord: false @@ -21,20 +33,10 @@ IndentCaseLabels: false IndentPPDirectives: AfterHash KeepEmptyLinesAtTheStartOfBlocks: false SpacesInContainerLiterals: false -AttributeMacros: - - SERD_ALLOCATED - - SERD_API - - SERD_CONST_FINC - - SERD_FALLTHROUGH - - SERD_MALLOC_FUNC - - SERD_NODISCARD - - SERD_NONNULL - - SERD_NULLABLE - - SERD_PURE_FUNC StatementMacros: - SERD_DEPRECATED_BY - - SERD_LOG_FUNC - SERD_DISABLE_NULL_WARNINGS + - SERD_LOG_FUNC - SERD_RESTORE_WARNINGS - _Pragma ... diff --git a/include/serd/serd.h b/include/serd/serd.h index 1f84950b..19b4a49c 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -127,8 +127,7 @@ typedef enum { } SerdStatus; /// Return a string describing a status code -SERD_CONST_API -const uint8_t* SERD_NONNULL +SERD_CONST_API const uint8_t* SERD_NONNULL serd_strerror(SerdStatus status); /** @@ -268,8 +267,7 @@ serd_file_uri_parse(const uint8_t* SERD_NONNULL uri, uint8_t* SERD_UNSPECIFIED* SERD_NULLABLE hostname); /// Return true iff `utf8` starts with a valid URI scheme -SERD_PURE_API -bool +SERD_PURE_API bool serd_uri_string_has_scheme(const uint8_t* SERD_NULLABLE utf8); /// Parse `utf8`, writing result to `out` @@ -501,8 +499,7 @@ SERD_API SerdNode serd_node_copy(const SerdNode* SERD_NULLABLE node); /// Return true iff `a` is equal to `b` -SERD_PURE_API -bool +SERD_PURE_API bool serd_node_equals(const SerdNode* SERD_NONNULL a, const SerdNode* SERD_NONNULL b); @@ -717,8 +714,7 @@ serd_reader_set_error_sink(SerdReader* SERD_NONNULL reader, void* SERD_UNSPECIFIED error_handle); /// Return the `handle` passed to serd_reader_new() -SERD_PURE_API -void* SERD_UNSPECIFIED +SERD_PURE_API void* SERD_UNSPECIFIED serd_reader_get_handle(const SerdReader* SERD_NONNULL reader); /** @@ -868,8 +864,7 @@ SERD_API void serd_writer_free(SerdWriter* SERD_NULLABLE writer); /// Return the env used by `writer` -SERD_PURE_API -SerdEnv* SERD_NONNULL +SERD_PURE_API SerdEnv* SERD_NONNULL serd_writer_get_env(SerdWriter* SERD_NONNULL writer); /** diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c index c855c103..62be0976 100644 --- a/test/headers/test_headers.c +++ b/test/headers/test_headers.c @@ -3,8 +3,7 @@ #include "serd/serd.h" // IWYU pragma: keep -SERD_CONST_FUNC -int +SERD_CONST_FUNC int main(void) { return 0; |