RE: [PATCH v4 2/8] block alloc: add lifecycle APIs for cache_entry structs
From: Jameson Miller <hidden>
Date: 2018-06-28 14:07:14
How much work is it to convert these to object_id while at it instead of char *sha1? (I think we really dislike introducing new sha1 based code; If it doesn't sound easy maybe we can have a static inline wrapper here that just converts oid to sha1 and then calls this function?)
I have made this change in my latest patch series with 0ac48f3af7 ("read-cache: make_cache_entry should take object_id struct", 2018-06-22)
Is it possible to line break these functions (c.f. refs.h which I think has one of the best styles in the git project. It has long parameter lists, but still manages to stay below a reasonable line length) ?quoted
+extern struct cache_entry *make_empty_cache_entry(struct index_state +*istate, size_t name_len);
I have formatted the function declarations to break them up
quoted
+ +/* + * Create a cache_entry that is not intended to be added to an index. + * Caller is responsible for discarding the cache_entry + * with `discard_cache_entry`. + */ +extern struct cache_entry *make_transient_cache_entry(unsigned int +mode, const unsigned char *sha1, const char *path, int stage); extern +struct cache_entry *make_empty_transient_cache_entry(size_t +name_len); + +/* + * Discard cache entry. + */ +void discard_cache_entry(struct cache_entry *ce);Please be consistent in the use of the extern keyword and omit them at all times here and above.
The header file is a bit inconsistent overall, but I switched my declarations to not use the extern keyword.