Staging
v0.5.2
https://github.com/git/git
Revision d3ac8c3f27a507d0489d18b51d6deba6364a99ce authored by Johannes Schindelin on 04 December 2019, 20:26:31 UTC, committed by Johannes Schindelin on 06 December 2019, 15:26:55 UTC
* maint-2.14: (28 commits)
  Git 2.14.6
  mingw: handle `subst`-ed "DOS drives"
  mingw: refuse to access paths with trailing spaces or periods
  mingw: refuse to access paths with illegal characters
  unpack-trees: let merged_entry() pass through do_add_entry()'s errors
  quote-stress-test: offer to test quoting arguments for MSYS2 sh
  t6130/t9350: prepare for stringent Win32 path validation
  quote-stress-test: allow skipping some trials
  quote-stress-test: accept arguments to test via the command-line
  tests: add a helper to stress test argument quoting
  mingw: fix quoting of arguments
  Disallow dubiously-nested submodule git directories
  protect_ntfs: turn on NTFS protection by default
  path: also guard `.gitmodules` against NTFS Alternate Data Streams
  is_ntfs_dotgit(): speed it up
  mingw: disallow backslash characters in tree objects' file names
  path: safeguard `.git` against NTFS Alternate Streams Accesses
  clone --recurse-submodules: prevent name squatting on Windows
  is_ntfs_dotgit(): only verify the leading segment
  test-path-utils: offer to run a protectNTFS/protectHFS benchmark
  ...
2 parent s 924c623 + 66d2a61
Raw File
Tip revision: d3ac8c3f27a507d0489d18b51d6deba6364a99ce authored by Johannes Schindelin on 04 December 2019, 20:26:31 UTC
Sync with 2.14.6
Tip revision: d3ac8c3
oidmap.h
#ifndef OIDMAP_H
#define OIDMAP_H

#include "hashmap.h"

/*
 * struct oidmap_entry is a structure representing an entry in the hash table,
 * which must be used as first member of user data structures.
 *
 * Users should set the oid field. oidmap_put() will populate the
 * internal_entry field.
 */
struct oidmap_entry {
	/* For internal use only */
	struct hashmap_entry internal_entry;

	struct object_id oid;
};

struct oidmap {
	struct hashmap map;
};

#define OIDMAP_INIT { { NULL } }

/*
 * Initializes an oidmap structure.
 *
 * `map` is the oidmap to initialize.
 *
 * If the total number of entries is known in advance, the `initial_size`
 * parameter may be used to preallocate a sufficiently large table and thus
 * prevent expensive resizing. If 0, the table is dynamically resized.
 */
extern void oidmap_init(struct oidmap *map, size_t initial_size);

/*
 * Frees an oidmap structure and allocated memory.
 *
 * If `free_entries` is true, each oidmap_entry in the map is freed as well
 * using stdlibs free().
 */
extern void oidmap_free(struct oidmap *map, int free_entries);

/*
 * Returns the oidmap entry for the specified oid, or NULL if not found.
 */
extern void *oidmap_get(const struct oidmap *map,
			const struct object_id *key);

/*
 * Adds or replaces an oidmap entry.
 *
 * ((struct oidmap_entry *) entry)->internal_entry will be populated by this
 * function.
 *
 * Returns the replaced entry, or NULL if not found (i.e. the entry was added).
 */
extern void *oidmap_put(struct oidmap *map, void *entry);

/*
 * Removes an oidmap entry matching the specified oid.
 *
 * Returns the removed entry, or NULL if not found.
 */
extern void *oidmap_remove(struct oidmap *map, const struct object_id *key);

#endif
back to top