From: Michael Haggerty Date: Mon, 10 Aug 2015 12:05:14 GMT Subject: Re: [PATCH 17/17] memoize common git-path "constant" files Message-ID: <55C8937A.3080206@alum.mit.edu> In-Reply-To: <20150810093857.GQ30981@sigill.intra.peff.net> On 08/10/2015 11:38 AM, Jeff King wrote: > [...] > This patch introduces a series of functions to "memoize" > these strings, which are essentially globals for the > lifetime of the program. We compute the value once, take > ownership of the buffer, and return the cached value for > subsequent calls. cache.h provides a helper macro for > defining these functions as one-liners, and defines a few > common ones for global use. > [...] I was wondering whether this memoization could interact badly with update_common_dir(). For example, if any of the memoized functions were called before git_common_dir is initialized, then the pre-git_common_dir value would continue to be used even if git_common_dir is changed afterwards. But I believe it is taboo to call git_path() before setup_git_env(), so I think this is not a problem. Michael -- Michael Haggerty mhagger@alum.mit.edu