Introduce diff_filespec_is_binary()

This replaces an explicit initialization of filespec->is_binary
field used for rename/break followed by direct access to that
field with a wrapper function that lazily iniaitlizes and
accesses the field.  We would add more attribute accesses for
the use of diff routines, and it would be better to make this
abstraction earlier.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2007-07-06 00:18:54 -07:00
parent 46f74f007b
commit 29a3eefde1
3 changed files with 39 additions and 36 deletions

View File

@ -129,7 +129,7 @@ static struct spanhash_top *hash_chars(struct diff_filespec *one)
struct spanhash_top *hash;
unsigned char *buf = one->data;
unsigned int sz = one->size;
int is_text = !one->is_binary;
int is_text = !diff_filespec_is_binary(one);
i = INITIAL_HASH_SIZE;
hash = xmalloc(sizeof(*hash) + sizeof(struct spanhash) * (1<<i));