Re: [PATCH 4/7] textconv: don't convert for every operation

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Junio C Hamano
Date: Saturday, October 25, 2008 - 11:32 am

Jeff King <peff@peff.net> writes:


Ah, I missed that driver named "default".  Sorry for the noise.


It would be either:

 (1) non-textconv users call fill_mmfile(&mf, ..., 0), use mf and return
     without clean-up as before, while textconv users do:

 	fill_mmfile(&mf, ..., 1);
        use mf;
        if (mf->ptr != one->data)
		clean up mf->ptr;
        return;

or

 (2) non-textconv users are unchanged from v1.6.0, while textconv users
     do:

	const char *textconv = get_textconv(...);
	fill_mmfile(&mf, ...); /* no change to fill_mmfile() */
	if (textconv)
        	munge_mmfile(&mf);
	use mf;
        if (textconv)
        	cleanup_mmfile(&mf);

The end result may not be that much different, but I find the latter
easier to follow for three reasons:

 * we expect that majority of the users of fill_mmfile() are non textconv
   users.  I'd feel safer to keep their codepath the same as v1.6.0;

 * fill_mmfile() semantics is the same as long before -- it just gives it
   a borrowed pointer;

 * the code that makes a change to mmfile that requires clean-up does so
   explicitly, and that is followed by an explicit clean-up, both
   contained in the same function;


Yes I was.  Thanks and sorry.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 4/7] textconv: don't convert for every operation, Junio C Hamano, (Sat Oct 25, 11:32 am)
[PATCH v3 1/8] diff: add missing static declaration, Jeff King, (Sat Oct 25, 9:41 pm)
[PATCH v3 3/8] add userdiff textconv tests, Jeff King, (Sat Oct 25, 9:42 pm)
[PATCH v3 4/8] refactor userdiff textconv code, Jeff King, (Sat Oct 25, 9:44 pm)
[PATCH v3 6/8] only textconv regular files, Jeff King, (Sat Oct 25, 9:46 pm)
[PATCH v3 7/8] wt-status: load diff ui config, Jeff King, (Sat Oct 25, 9:49 pm)