git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH v2 1/2] config: Add hashtable for config parsing & retrieval

From
Torsten Bögershausen <tboegi@web.de>
Date
Jun 2, 2014, 19:33 UTC
Message-ID
<538CD1A2.4020400@web.de>
In-Reply-To
<1401720460-6525-2-git-send-email-tanayabh@gmail.com>
On 2014-06-02 16.47, Tanay Abhra wrote:

[] Please see 3 minor remarks inline.

Show 24 quoted lines
> --- a/config.c
> +++ b/config.c
> @@ -9,6 +9,8 @@
>  #include "exec_cmd.h"
>  #include "strbuf.h"
>  #include "quote.h"
> +#include "hashmap.h"
> +#include "string-list.h"
>  
>  struct config_source {
>  	struct config_source *prev;
> @@ -37,6 +39,112 @@ static struct config_source *cf;
>  
>  static int zlib_compression_seen;
>  
> +static struct hashmap config_cache;
> +
> +struct config_cache_entry {
> +	struct hashmap_entry ent;
> +	char *key;
> +	struct string_list *value_list;
> +};
> +
> +static int hashmap_is_init = 0;
we don't need the " = 0", as all static data is initialized to 0 (or NULL) 
> +
> +static int config_cache_entry_cmp_icase(const struct config_cache_entry *e1,
> +				 const struct config_cache_entry *e2, const char* key)

the * should be aligned to the variable "key": const char *key

[]
Show 7 quoted lines
> +static void config_cache_set_value(const char *key, const char *value)
> +{
> +	struct config_cache_entry *e;
> +
> +	e = config_cache_find_entry(key);
> +	if (!e) {
> +		e = malloc(sizeof(*e));
I think we need xmalloc() here (from wrapper.c)
Previous: Tanay AbhraNext: Jeff King
Message 3 of 7 in “Git config cache & special querying api utilizing the cache”
  1. 0/2 Git config cache & special querying api utilizing the cacheTanay Abhra, Jun 2, 2014
  2. 1/2 config: Add hashtable for config parsing & retrievalTanay Abhra, Jun 2, 2014
  3. Torsten BögershausenJun 2, 2014
  4. Jeff KingJun 3, 2014
  5. Eric SunshineJun 9, 2014
  6. 2/2 config: Add new query functions to the api docsTanay Abhra, Jun 2, 2014
  7. Matthieu MoyJun 3, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.