Files
git/symlinks.h
Tian Yuchen 96286f14b0 symlinks: use unsigned int for flags
The 'flags' and 'track_flags' fields in symlinks.c are used
strictly as a collection of bits (using bitwise operators including
&, |, ~). Using a signed integer for bitmasks may lead to undefined
behavior with shift operations and logic errors if the MSB is touched.

Change these fields from 'int' to 'unsigned int' to match our usage
patterns.

Signed-off-by: Tian Yuchen <a3205153416@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-20 15:03:42 -08:00

29 lines
755 B
C

#ifndef SYMLINKS_H
#define SYMLINKS_H
#include "strbuf.h"
struct cache_def {
struct strbuf path;
unsigned int flags;
unsigned int track_flags;
int prefix_len_stat_func;
};
#define CACHE_DEF_INIT { \
.path = STRBUF_INIT, \
}
static inline void cache_def_clear(struct cache_def *cache)
{
strbuf_release(&cache->path);
}
int has_symlink_leading_path(const char *name, int len);
int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
int check_leading_path(const char *name, int len, int warn_on_lstat_err);
int has_dirs_only_path(const char *name, int len, int prefix_len);
void invalidate_lstat_cache(void);
void schedule_dir_for_removal(const char *name, int len);
void remove_scheduled_dirs(void);
#endif /* SYMLINKS_H */