mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-06-29 22:08:52 +00:00
chore: misc cleanup
This commit is contained in:
parent
cadde0b61e
commit
9fab17734c
10 changed files with 48 additions and 68 deletions
|
@ -28,9 +28,7 @@ AS_CASE(["${host_os}"], [linux*], [
|
||||||
], [freebsd*], [
|
], [freebsd*], [
|
||||||
AS_VAR_SET([host_os_is_freebsd], [yes])
|
AS_VAR_SET([host_os_is_freebsd], [yes])
|
||||||
], [
|
], [
|
||||||
AC_MSG_WARN(m4_normalize([
|
AC_MSG_WARN(m4_normalize([Unsupported platform "${host_os}".]))
|
||||||
Unsupported platform "${host_os}".
|
|
||||||
]))
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# -- Checks for programs --
|
# -- Checks for programs --
|
||||||
|
@ -176,6 +174,7 @@ AX_GCC_FUNC_ATTRIBUTE([cold])
|
||||||
AX_GCC_FUNC_ATTRIBUTE([destructor])
|
AX_GCC_FUNC_ATTRIBUTE([destructor])
|
||||||
AX_GCC_FUNC_ATTRIBUTE([malloc])
|
AX_GCC_FUNC_ATTRIBUTE([malloc])
|
||||||
AX_GCC_FUNC_ATTRIBUTE([noreturn])
|
AX_GCC_FUNC_ATTRIBUTE([noreturn])
|
||||||
|
AX_GCC_FUNC_ATTRIBUTE([pure])
|
||||||
AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])
|
AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])
|
||||||
AX_GCC_FUNC_ATTRIBUTE([visibility])
|
AX_GCC_FUNC_ATTRIBUTE([visibility])
|
||||||
AX_GCC_VAR_ATTRIBUTE([unused])
|
AX_GCC_VAR_ATTRIBUTE([unused])
|
||||||
|
@ -209,8 +208,7 @@ m4_version_prereq([2.72], [
|
||||||
AC_SYS_YEAR2038
|
AC_SYS_YEAR2038
|
||||||
AS_VAR_IF([ac_have_year2038], [no], [
|
AS_VAR_IF([ac_have_year2038], [no], [
|
||||||
AC_MSG_ERROR(m4_normalize([
|
AC_MSG_ERROR(m4_normalize([
|
||||||
64-bit time_t (required by some backends) is unsupported on
|
64-bit time_t is unsupported on this platform.
|
||||||
this platform.
|
|
||||||
]))
|
]))
|
||||||
])
|
])
|
||||||
], [
|
], [
|
||||||
|
|
|
@ -3648,7 +3648,6 @@ If this function is never called, the hash function bahaves as if it is
|
||||||
seeded with all bits zero.
|
seeded with all bits zero.
|
||||||
|
|
||||||
@item hash_digest
|
@item hash_digest
|
||||||
|
|
||||||
Calculates the digest of the given input.
|
Calculates the digest of the given input.
|
||||||
|
|
||||||
@example c
|
@example c
|
||||||
|
@ -3660,7 +3659,6 @@ hash_digest (
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@item hash_digestv
|
@item hash_digestv
|
||||||
|
|
||||||
Like @code{hash_digest()}, but takes input from multiple buffers.
|
Like @code{hash_digest()}, but takes input from multiple buffers.
|
||||||
|
|
||||||
@example c
|
@example c
|
||||||
|
@ -3675,7 +3673,6 @@ The function is guaranteed not to modify the buffer data of each
|
||||||
@code{struct iovec} object.
|
@code{struct iovec} object.
|
||||||
|
|
||||||
@item hash_digestcb
|
@item hash_digestcb
|
||||||
|
|
||||||
Like @code{hash_digestv()}, but takes input buffers from a callback function.
|
Like @code{hash_digestv()}, but takes input buffers from a callback function.
|
||||||
|
|
||||||
@example c
|
@example c
|
||||||
|
@ -3690,7 +3687,6 @@ Function arguments:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item callback
|
@item callback
|
||||||
|
|
||||||
The function to provide input buffers.
|
The function to provide input buffers.
|
||||||
It must not be @code{NULL}.
|
It must not be @code{NULL}.
|
||||||
|
|
||||||
|
@ -3981,7 +3977,6 @@ Functions:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item prng_seed
|
@item prng_seed
|
||||||
|
|
||||||
Updates the seed used by the PRNG.
|
Updates the seed used by the PRNG.
|
||||||
|
|
||||||
@example c
|
@example c
|
||||||
|
@ -4225,7 +4220,6 @@ watcher_destroy (
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@item watcher_poll
|
@item watcher_poll
|
||||||
|
|
||||||
Checks whether the file being watched has changed.
|
Checks whether the file being watched has changed.
|
||||||
This function never blocks.
|
This function never blocks.
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ AC_DEFUN([BOOKMARKFS_AMCOND], [
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl BOOKMARKFS_FEAT_OUT([features]...)
|
dnl BOOKMARKFS_FEAT_EXPORT([features]...)
|
||||||
dnl
|
dnl
|
||||||
dnl Export feature flags to Autoconf output variables,
|
dnl Export feature flags to Autoconf output variables,
|
||||||
dnl similar to the ones set by AM_CONTITIONAL() (`xxx_TRUE` only).
|
dnl similar to the ones set by AM_CONTITIONAL() (`xxx_TRUE` only).
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
#define BACKEND_OPT_BAD_VAL() BACKEND_OPT_ERR_(BAD_VAL)
|
#define BACKEND_OPT_BAD_VAL() BACKEND_OPT_ERR_(BAD_VAL)
|
||||||
#define BACKEND_OPT_NO_VAL \
|
#define BACKEND_OPT_NO_VAL \
|
||||||
if (val_ != NULL) return BACKEND_OPT_ERR_(HAS_VAL);
|
if (val_ != NULL) return BACKEND_OPT_ERR_(HAS_VAL);
|
||||||
#define BACKEND_OPT_VAL_STR val_
|
#define BACKEND_OPT_VAL_STR (val_)
|
||||||
|
|
||||||
#define FILENAME_BADCHAR -1
|
#define FILENAME_BADCHAR -1
|
||||||
#define FILENAME_BADLEN -2
|
#define FILENAME_BADLEN -2
|
||||||
|
@ -67,14 +67,12 @@
|
||||||
* Returns the directory file descriptor if successful.
|
* Returns the directory file descriptor if successful.
|
||||||
* On error, -1 is returned, and errno is set.
|
* On error, -1 is returned, and errno is set.
|
||||||
*/
|
*/
|
||||||
BOOKMARKFS_INTERNAL
|
|
||||||
int
|
int
|
||||||
basename_opendir (
|
basename_opendir (
|
||||||
char *path,
|
char *path,
|
||||||
char **basename_ptr
|
char **basename_ptr
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOKMARKFS_INTERNAL
|
|
||||||
FUNCATTR_COLD
|
FUNCATTR_COLD
|
||||||
int
|
int
|
||||||
print_backend_opt_err_ (
|
print_backend_opt_err_ (
|
||||||
|
@ -91,7 +89,6 @@ print_backend_opt_err_ (
|
||||||
* If returning FILENAME_BADCHAR, stores the pointer to the first
|
* If returning FILENAME_BADCHAR, stores the pointer to the first
|
||||||
* bad character to `end_ptr` unless it is NULL.
|
* bad character to `end_ptr` unless it is NULL.
|
||||||
*/
|
*/
|
||||||
BOOKMARKFS_INTERNAL
|
|
||||||
int
|
int
|
||||||
validate_filename (
|
validate_filename (
|
||||||
char const *str,
|
char const *str,
|
||||||
|
@ -99,7 +96,6 @@ validate_filename (
|
||||||
char const **end_ptr
|
char const **end_ptr
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOKMARKFS_INTERNAL
|
|
||||||
int
|
int
|
||||||
validate_filename_fsck (
|
validate_filename_fsck (
|
||||||
char const *str,
|
char const *str,
|
||||||
|
|
15
src/defs.h
15
src/defs.h
|
@ -61,6 +61,12 @@
|
||||||
# endif /* defined(HAVE_FUNC_ATTRIBUTE_NORETURN) */
|
# endif /* defined(HAVE_FUNC_ATTRIBUTE_NORETURN) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_FUNC_ATTRIBUTE_PURE
|
||||||
|
# define FUNCATTR_PURE __attribute__((pure))
|
||||||
|
#else
|
||||||
|
# define FUNCATTR_PURE
|
||||||
|
#endif /* defined(HAVE_FUNC_ATTRIBUTE_PURE) */
|
||||||
|
|
||||||
#ifdef HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
|
#ifdef HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
|
||||||
# define FUNCATTR_RETURNS_NONNULL __attribute__((returns_nonnull))
|
# define FUNCATTR_RETURNS_NONNULL __attribute__((returns_nonnull))
|
||||||
#else
|
#else
|
||||||
|
@ -86,15 +92,6 @@
|
||||||
# define UNUSED_VAR(name) name##_unused_ VARATTR_UNUSED_
|
# define UNUSED_VAR(name) name##_unused_ VARATTR_UNUSED_
|
||||||
#endif /* defined(HAVE_STDC_23) */
|
#endif /* defined(HAVE_STDC_23) */
|
||||||
|
|
||||||
#if defined(HAVE_STDC_23)
|
|
||||||
# define BOOKMARKFS_TLS thread_local
|
|
||||||
#elif defined(HAVE_STDC_11)
|
|
||||||
# define BOOKMARKFS_TLS _Thread_local
|
|
||||||
// Incomprehensive list. Add more if needed.
|
|
||||||
#elif defined(__GNUC__) || defined(__clang__)
|
|
||||||
# define BOOKMARKFS_TLS __thread
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || (defined(__linux__) && defined(_GNU_SOURCE))
|
#if defined(__FreeBSD__) || (defined(__linux__) && defined(_GNU_SOURCE))
|
||||||
# define HAVE_PIPE2 1
|
# define HAVE_PIPE2 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -197,7 +197,7 @@ static int bm_create (uint64_t, char const *, int, struct stat *);
|
||||||
static int bm_delete (uint64_t, char const *, uint32_t);
|
static int bm_delete (uint64_t, char const *, uint32_t);
|
||||||
static int bm_do_write (uint64_t, struct fs_file_handle *);
|
static int bm_do_write (uint64_t, struct fs_file_handle *);
|
||||||
static void bm_fh_free (struct fs_file_handle *, long);
|
static void bm_fh_free (struct fs_file_handle *, long);
|
||||||
static struct fs_file_handle *
|
static struct fs_file_handle * FUNCATTR_PURE
|
||||||
bm_fh_get (uint64_t, unsigned long *, unsigned long *);
|
bm_fh_get (uint64_t, unsigned long *, unsigned long *);
|
||||||
static struct fs_file_handle *
|
static struct fs_file_handle *
|
||||||
bm_fh_new (uint64_t);
|
bm_fh_new (uint64_t);
|
||||||
|
|
|
@ -25,11 +25,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
BOOKMARKFS_INTERNAL
|
|
||||||
int
|
int
|
||||||
bookmarkfs_lib_init (void);
|
bookmarkfs_lib_init (void);
|
||||||
|
|
||||||
BOOKMARKFS_INTERNAL
|
|
||||||
FUNCATTR_COLD
|
FUNCATTR_COLD
|
||||||
void
|
void
|
||||||
bookmarkfs_print_lib_version (
|
bookmarkfs_print_lib_version (
|
||||||
|
|
|
@ -45,8 +45,5 @@ $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4 $(TESTS_)
|
||||||
check-local: atconfig atlocal $(TESTSUITE)
|
check-local: atconfig atlocal $(TESTSUITE)
|
||||||
$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
|
$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
|
||||||
|
|
||||||
installcheck-local: atconfig atlocal $(TESTSUITE)
|
|
||||||
$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) AUTOTEST_PATH='$(bindir)'
|
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' --clean
|
test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' --clean
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
/**
|
/**
|
||||||
* bookmarkfs/tests/check_sandbox.c
|
* bookmarkfs/tests/check_sandbox.c
|
||||||
* ----
|
* ----
|
||||||
*
|
*
|
||||||
* Copyright (C) 2025 CismonX <admin@cismon.net>
|
* Copyright (C) 2025 CismonX <admin@cismon.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
/**
|
/**
|
||||||
* bookmarkfs/tests/check_watcher.c
|
* bookmarkfs/tests/check_watcher.c
|
||||||
* ----
|
* ----
|
||||||
*
|
*
|
||||||
* Copyright (C) 2025 CismonX <admin@cismon.net>
|
* Copyright (C) 2025 CismonX <admin@cismon.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
Loading…
Add table
Reference in a new issue