Revision 4553f9de23f8d451bf801b566247bf987570626a authored by Johannes Schindelin on 29 July 2019, 20:08:11 UTC, committed by Junio C Hamano on 29 July 2019, 21:51:43 UTC
With the recent changes to allow building with MSVC=1, we now pass the
/OPT:REF option to the compiler. This confuses the parser that wants to
turn the output of a dry run into project definitions for QMake and Visual
Studio:

	Unhandled link option @ line 213: /OPT:REF at [...]

Let's just extend the code that passes through options that start with a
dash, so that it passes through options that start with a slash, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 6e50021
Raw File
oidmap.c
#include "cache.h"
#include "oidmap.h"

static int oidmap_neq(const void *hashmap_cmp_fn_data,
		      const void *entry, const void *entry_or_key,
		      const void *keydata)
{
	const struct oidmap_entry *entry_ = entry;
	if (keydata)
		return !oideq(&entry_->oid, (const struct object_id *) keydata);
	return !oideq(&entry_->oid,
		      &((const struct oidmap_entry *) entry_or_key)->oid);
}

static int hash(const struct object_id *oid)
{
	int hash;
	memcpy(&hash, oid->hash, sizeof(hash));
	return hash;
}

void oidmap_init(struct oidmap *map, size_t initial_size)
{
	hashmap_init(&map->map, oidmap_neq, NULL, initial_size);
}

void oidmap_free(struct oidmap *map, int free_entries)
{
	if (!map)
		return;
	hashmap_free(&map->map, free_entries);
}

void *oidmap_get(const struct oidmap *map, const struct object_id *key)
{
	if (!map->map.cmpfn)
		return NULL;

	return hashmap_get_from_hash(&map->map, hash(key), key);
}

void *oidmap_remove(struct oidmap *map, const struct object_id *key)
{
	struct hashmap_entry entry;

	if (!map->map.cmpfn)
		oidmap_init(map, 0);

	hashmap_entry_init(&entry, hash(key));
	return hashmap_remove(&map->map, &entry, key);
}

void *oidmap_put(struct oidmap *map, void *entry)
{
	struct oidmap_entry *to_put = entry;

	if (!map->map.cmpfn)
		oidmap_init(map, 0);

	hashmap_entry_init(&to_put->internal_entry, hash(&to_put->oid));
	return hashmap_put(&map->map, to_put);
}
back to top