From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff King Subject: Re: [PATCH 1/3] implement generic key/value map Date: Thu, 14 Jul 2011 15:14:16 -0400 Message-ID: <20110714191416.GC26918@sigill.intra.peff.net> References: <20110714173454.GA21657@sigill.intra.peff.net> <20110714175105.GA21771@sigill.intra.peff.net> <20110714185539.GA27141@sigill.intra.peff.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Jonathan Nieder , git@vger.kernel.org, Junio C Hamano , Jakub Narebski , Ted Ts'o , =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= , Clemens Buchacher , "Shawn O. Pearce" , David Barr To: Bert Wesarg X-From: git-owner@vger.kernel.org Thu Jul 14 21:14:24 2011 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QhRMd-0007P2-FT for gcvg-git-2@lo.gmane.org; Thu, 14 Jul 2011 21:14:23 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753065Ab1GNTOT (ORCPT ); Thu, 14 Jul 2011 15:14:19 -0400 Received: from 99-108-226-0.lightspeed.iplsin.sbcglobal.net ([99.108.226.0]:59387 "EHLO peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752804Ab1GNTOS (ORCPT ); Thu, 14 Jul 2011 15:14:18 -0400 Received: (qmail 10413 invoked by uid 107); 14 Jul 2011 19:14:43 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) (smtp-auth username relayok, mechanism cram-md5) by peff.net (qpsmtpd/0.84) with ESMTPA; Thu, 14 Jul 2011 15:14:43 -0400 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Thu, 14 Jul 2011 15:14:16 -0400 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Thu, Jul 14, 2011 at 09:07:54PM +0200, Bert Wesarg wrote: > > Yeah, you could treat this like a C++ template and assume random bits of > > code will instantiate a map of whatever types they need. But this is C, > > and we only want to instantiate once. So I just figured to keep the > > static list of whatever maps git needs in the map.[ch] files. > > When I wrote such macros in the past, the 'generated' functions where > all static. So one could instantiate a map multiple times in different > compilation units where one need to access this type of map. Yeah, that would work. It can bloat the code more, but in practice, not much. It would also work better if we were providing the map API as a library to arbitrary code. But we have the luxury of knowing all of the types that will be used with it at compile time. :) -Peff