summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-11-01 22:58:35 -0400
committerDavid Robillard <d@drobilla.net>2022-11-01 22:58:35 -0400
commit9af648d05e78c3ee9f39ad02b5ccda895d0d867d (patch)
tree99f1c1096bdfeba7f68400d7e0dc990f50420941
parent4fdc484caddfbd95f1f0f72c6668c1397f46bf46 (diff)
downloadzix-9af648d05e78c3ee9f39ad02b5ccda895d0d867d.tar.gz
zix-9af648d05e78c3ee9f39ad02b5ccda895d0d867d.tar.bz2
zix-9af648d05e78c3ee9f39ad02b5ccda895d0d867d.zip
Add missing pure and const function attributes
It seems that certain versions and/or configurations of gcc warn about these for static functions, which is annoying, but whatever.
-rw-r--r--src/path.c6
-rw-r--r--src/posix/filesystem_posix.c1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c
index aa787b3..aedf059 100644
--- a/src/path.c
+++ b/src/path.c
@@ -92,6 +92,7 @@ typedef struct {
ZixIndexRange dir;
} ZixRootSlices;
+ZIX_PURE_FUNC
static ZixRootSlices
zix_path_root_slices(const char* const path)
{
@@ -127,6 +128,7 @@ zix_string_ranges_equal(const char* const lhs,
!strncmp(lhs + lhs_range.begin, rhs + rhs_range.begin, lhs_len));
}
+ZIX_PURE_FUNC
static ZixIndexRange
zix_path_root_path_range(const char* const path)
{
@@ -138,6 +140,7 @@ zix_path_root_path_range(const char* const path)
: zix_make_range(root.name.begin, root.name.end + dir_len);
}
+ZIX_PURE_FUNC
static ZixIndexRange
zix_path_parent_path_range(const ZixStringView path)
{
@@ -175,6 +178,7 @@ zix_path_parent_path_range(const ZixStringView path)
return zix_make_range(root.begin, root.begin + l + 1U - p);
}
+ZIX_PURE_FUNC
static ZixIndexRange
zix_path_filename_range(const ZixStringView path)
{
@@ -193,6 +197,7 @@ zix_path_filename_range(const ZixStringView path)
return zix_make_range(f, path.length);
}
+ZIX_PURE_FUNC
static ZixIndexRange
zix_path_stem_range(const ZixStringView path)
{
@@ -212,6 +217,7 @@ zix_path_stem_range(const ZixStringView path)
return zix_is_empty_range(stem) ? name : stem;
}
+ZIX_PURE_FUNC
static ZixIndexRange
zix_path_extension_range(const ZixStringView path)
{
diff --git a/src/posix/filesystem_posix.c b/src/posix/filesystem_posix.c
index 0360403..277c3d0 100644
--- a/src/posix/filesystem_posix.c
+++ b/src/posix/filesystem_posix.c
@@ -368,6 +368,7 @@ zix_file_unlock(FILE* const file, const ZixFileLockMode mode)
#endif
}
+ZIX_CONST_FUNC
static ZixFileType
stat_file_type(const struct stat sb)
{