]> git.ipfire.org Git - thirdparty/git.git/blobdiff - cache.h
fast-import: filemodify after M 040000 <tree> "" crashes
[thirdparty/git.git] / cache.h
diff --git a/cache.h b/cache.h
index 2ef2fa3a5e166d94e5e981ca7c76afad13236e7e..3d5ed51989d6c118062c0709eae41fcb3cc6543b 100644 (file)
--- 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)