mirror of
https://github.com/git/git.git
synced 2024-11-23 09:56:28 +08:00
9720d23e8c
date_mode_from_type() modifies a static variable and returns a pointer to it. This is not thread-safe. Most callers of date_mode_from_type() use it via the macro DATE_MODE and pass its result on to functions like show_date(), which take a const pointer and don't modify the struct. Avoid the static storage by putting the variable on the stack and returning the whole struct date_mode. Change functions that take a constant pointer to expect the whole struct instead. Reduce the cost of passing struct date_mode around on 64-bit systems by reordering its members to close the hole between the 32-bit wide .type and the 64-bit aligned .strftime_fmt as well as the alignment hole at the end. sizeof reports 24 before and 16 with this change on x64. Keep .type at the top to still allow initialization without designator -- though that's only done in a single location, in builtin/blame.c. Signed-off-by: René Scharfe <l.s.r@web.de> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
28 lines
930 B
C
28 lines
930 B
C
#ifndef REFLOG_WALK_H
|
|
#define REFLOG_WALK_H
|
|
|
|
struct commit;
|
|
struct reflog_walk_info;
|
|
struct date_mode;
|
|
|
|
void init_reflog_walk(struct reflog_walk_info **info);
|
|
void reflog_walk_info_release(struct reflog_walk_info *info);
|
|
int add_reflog_for_walk(struct reflog_walk_info *info,
|
|
struct commit *commit, const char *name);
|
|
void show_reflog_message(struct reflog_walk_info *info, int,
|
|
struct date_mode, int force_date);
|
|
void get_reflog_message(struct strbuf *sb,
|
|
struct reflog_walk_info *reflog_info);
|
|
const char *get_reflog_ident(struct reflog_walk_info *reflog_info);
|
|
timestamp_t get_reflog_timestamp(struct reflog_walk_info *reflog_info);
|
|
void get_reflog_selector(struct strbuf *sb,
|
|
struct reflog_walk_info *reflog_info,
|
|
struct date_mode dmode, int force_date,
|
|
int shorten);
|
|
|
|
int reflog_walk_empty(struct reflog_walk_info *walk);
|
|
|
|
struct commit *next_reflog_entry(struct reflog_walk_info *reflog_info);
|
|
|
|
#endif
|