chore: tidy up

This commit is contained in:
CismonX 2025-03-01 23:40:34 +08:00
parent f3f522ae63
commit 8cbd5846d9
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
5 changed files with 12 additions and 11 deletions

View file

@ -1855,7 +1855,7 @@ backend_sandbox (
if (ctx->flags & BOOKMARKFS_BACKEND_READONLY) {
sandbox_flags |= SANDBOX_READONLY;
}
#ifdef __Linux__
#ifdef __linux__
if (ctx->flags & BOOKMARKFS_BACKEND_NO_LANDLOCK) {
sandbox_flags |= SANDBOX_NO_LANDLOCK;
}
@ -2465,7 +2465,8 @@ bookmark_rename (
debug_assert(!(ctx->flags & BOOKMARKFS_BACKEND_READONLY));
if (old_parent_id == BOOKMARKS_ROOT_ID
|| new_parent_id == BOOKMARKS_ROOT_ID) {
|| new_parent_id == BOOKMARKS_ROOT_ID
) {
return -EPERM;
}
int status = store_load(ctx);
@ -2487,8 +2488,8 @@ bookmark_rename (
struct lookup_ctx old_lctx;
struct node_entry *old_entry;
if (0 != lookup_name(ctx, old_parent_id, old_name, old_name_len,
&old_lctx, &old_entry))
{
&old_lctx, &old_entry)
) {
return -ENOENT;
}
json_t *old_node = old_entry->node;
@ -2509,8 +2510,8 @@ bookmark_rename (
struct lookup_ctx new_lctx;
struct node_entry *new_entry;
if (0 == lookup_name(ctx, new_parent_id, new_name, new_name_len,
&new_lctx, &new_entry))
{
&new_lctx, &new_entry)
) {
if (flags & BOOKMARKFS_BOOKMARK_RENAME_NOREPLACE) {
return -EEXIST;
}

View file

@ -2127,8 +2127,8 @@ bookmark_do_list (
uint32_t bookmark_type = flags & BOOKMARKFS_BOOKMARK_TYPE_MASK;
bookmark_type >>= BOOKMARKFS_BOOKMARK_TYPE_SHIFT;
if (bookmark_type == BOOKMARKFS_BOOKMARK_TYPE_TAG
&& id == ctx->tags_root_id)
{
&& id == ctx->tags_root_id
) {
bookmark_type = BOOKMARKFS_BOOKMARK_TYPE_BOOKMARK;
}

View file

@ -30,13 +30,13 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#ifdef __linux__
# include <sys/xattr.h>
#endif
#include <time.h>
#include <unistd.h>
#include "hash.h"

View file

@ -41,7 +41,7 @@
#define WATCHER_FALLBACK ( 1u << 0 )
/**
* Nothing is performed on the filesystem,
* and watcher_poll() always returns WATCHER_POLL_NOCHANGE.
* and watcher_poll() always returns -EAGAIN.
*/
#define WATCHER_NOOP ( 1u << 1 )

View file

@ -171,7 +171,7 @@ xstrerror (
/**
* Like xstrerror(), but takes `errno` as error number,
* and saves its value to `err_ptr`.
* and saves its value to `errnum_ptr`.
*/
BOOKMARKFS_INTERNAL
FUNCATTR_RETURNS_NONNULL