git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
blob ce3b8a4a321b977b595ea7bac2dd9e22697a43cc 944 bytes (raw)
name: prefix-map.h 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
#ifndef PREFIX_MAP_H
#define PREFIX_MAP_H

#include "hashmap.h"

struct prefix_item {
	const char *name;
	size_t prefix_length;
};

struct prefix_map_entry {
	struct hashmap_entry e;
	const char *name;
	size_t prefix_length;
	/* if item is NULL, the prefix is not unique */
	struct prefix_item *item;
};

struct prefix_map {
	struct hashmap map;
	int min_length, max_length;
};

/*
 * Find unique prefixes in a given list of strings.
 *
 * Typically, the `struct prefix_item` information will be but a field in the
 * actual item struct; For this reason, the `list` parameter is specified as a
 * list of pointers to the items.
 *
 * The `min_length`/`max_length` parameters define what length the unique
 * prefixes should have.
 *
 * If no unique prefix could be found for a given item, its `prefix_length`
 * will be set to 0.
 */
void find_unique_prefixes(struct prefix_item **list, size_t nr,
			  int min_length, int max_length);

#endif

debug log:

solving ce3b8a4a32 ...
found ce3b8a4a32 in https://public-inbox.org/git/3000d7d08dfb64511b4ebf9d05617897dd7252f7.1563289115.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/e02a52c3acf64657c012744108d7ccc3ecdf1b43.1557768471.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/db1ede363645b0620d4924639efe5ec708441aa7.1554917868.git.gitgitgadget@gmail.com/

applying [1/1] https://public-inbox.org/git/3000d7d08dfb64511b4ebf9d05617897dd7252f7.1563289115.git.gitgitgadget@gmail.com/
diff --git a/prefix-map.h b/prefix-map.h
new file mode 100644
index 0000000000..ce3b8a4a32

Checking patch prefix-map.h...
Applied patch prefix-map.h cleanly.

skipping https://public-inbox.org/git/e02a52c3acf64657c012744108d7ccc3ecdf1b43.1557768471.git.gitgitgadget@gmail.com/ for ce3b8a4a32
skipping https://public-inbox.org/git/db1ede363645b0620d4924639efe5ec708441aa7.1554917868.git.gitgitgadget@gmail.com/ for ce3b8a4a32
index at:
100644 ce3b8a4a321b977b595ea7bac2dd9e22697a43cc	prefix-map.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).