fix syntax error for macro substituting a function call
[git-cheetah/kirill.git] / common / cache.h
blob6a3fb231f7a2b191d4167807059934db87da0d22
1 #ifndef CACHE_H
2 #define CACHE_H
4 #include "git-compat-util.h"
5 #include "strbuf.h"
7 enum date_mode {
8 DATE_NORMAL = 0,
9 DATE_RELATIVE,
10 DATE_SHORT,
11 DATE_LOCAL,
12 DATE_ISO8601,
13 DATE_RFC2822
16 #define alloc_nr(x) (((x)+16)*3/2)
19 * Realloc the buffer pointed at by variable 'x' so that it can hold
20 * at least 'nr' entries; the number of entries currently allocated
21 * is 'alloc', using the standard growing factor alloc_nr() macro.
23 * DO NOT USE any expression with side-effect for 'x' or 'alloc'.
25 #define ALLOC_GROW(x, nr, alloc) \
26 do { \
27 if ((nr) > alloc) { \
28 if (alloc_nr(alloc) < (nr)) \
29 alloc = (nr); \
30 else \
31 alloc = alloc_nr(alloc); \
32 x = xrealloc((x), alloc * sizeof(*(x))); \
33 } \
34 } while(0)
36 struct pack_window {
37 struct pack_window *next;
38 unsigned char *base;
39 off_t offset;
40 size_t len;
41 unsigned int last_used;
42 unsigned int inuse_cnt;
45 extern struct packed_git {
46 struct packed_git *next;
47 struct pack_window *windows;
48 off_t pack_size;
49 const void *index_data;
50 size_t index_size;
51 uint32_t num_objects;
52 uint32_t num_bad_objects;
53 unsigned char *bad_object_sha1;
54 int index_version;
55 time_t mtime;
56 int pack_fd;
57 int pack_local;
58 unsigned char sha1[20];
59 /* something like ".git/objects/pack/xxxxx.pack" */
60 char pack_name[FLEX_ARRAY]; /* more */
61 } *packed_git;
63 #endif /* CACHE_H */