X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=cache.h;h=33decd942d4985c8efc1c75fd3fa2f4adf4a56ca;hb=60109d0ef5974b5066b6998fafe1da7187174c88;hp=2ef2fa3a5e166d94e5e981ca7c76afad13236e7e;hpb=2851e8eba52e98d3112417952a24d82ae9d8c0eb;p=git.git diff --git a/cache.h b/cache.h index 2ef2fa3a5..33decd942 100644 --- a/cache.h +++ b/cache.h @@ -277,9 +277,16 @@ static inline int ce_to_dtype(const struct cache_entry *ce) else return DT_UNKNOWN; } -#define canon_mode(mode) \ - (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \ - S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFGITLINK) +static inline unsigned int canon_mode(unsigned int mode) +{ + if (S_ISREG(mode)) + return S_IFREG | ce_permissions(mode); + if (S_ISLNK(mode)) + return S_IFLNK; + if (S_ISDIR(mode)) + return S_IFDIR; + return S_IFGITLINK; +} #define flexible_size(STRUCT,len) ((offsetof(struct STRUCT,name) + (len) + 8) & ~7) #define cache_entry_size(len) flexible_size(cache_entry,len) @@ -438,7 +445,7 @@ extern int init_db(const char *template_dir, unsigned int flags); * at least 'nr' entries; the number of entries currently allocated * is 'alloc', using the standard growing factor alloc_nr() macro. * - * DO NOT USE any expression with side-effect for 'x' or 'alloc'. + * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'. */ #define ALLOC_GROW(x, nr, alloc) \ do { \