Skip to content

Commit b6b9f83

Browse files
committed
Merge branch 'maint'
* maint: rebase -i: abort cleanly if the editor fails to launch technical-docs: document hash API api-strbuf.txt: fix typos and document launch_editor()
2 parents 8eca03c + e49ca97 commit b6b9f83

File tree

3 files changed

+57
-5
lines changed

3 files changed

+57
-5
lines changed

Documentation/technical/api-hash.txt

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
11
hash API
22
========
33

4-
Talk about <hash.h>
4+
The hash API is a collection of simple hash table functions. Users are expected
5+
to implement their own hashing.
56

6-
(Linus)
7+
Data Structures
8+
---------------
9+
10+
`struct hash_table`::
11+
12+
The hash table structure. The `array` member points to the hash table
13+
entries. The `size` member counts the total number of valid and invalid
14+
entries in the table. The `nr` member keeps track of the number of
15+
valid entries.
16+
17+
`struct hash_table_entry`::
18+
19+
An opaque structure representing an entry in the hash table. The `hash`
20+
member is the entry's hash key and the `ptr` member is the entry's
21+
value.
22+
23+
Functions
24+
---------
25+
26+
`init_hash`::
27+
28+
Initialize the hash table.
29+
30+
`free_hash`::
31+
32+
Release memory associated with the hash table.
33+
34+
`insert_hash`::
35+
36+
Insert a pointer into the hash table. If an entry with that hash
37+
already exists, a pointer to the existing entry's value is returned.
38+
Otherwise NULL is returned. This allows callers to implement
39+
chaining, etc.
40+
41+
`lookup_hash`::
42+
43+
Lookup an entry in the hash table. If an entry with that hash exists
44+
the entry's value is returned. Otherwise NULL is returned.
45+
46+
`for_each_hash`::
47+
48+
Call a function for each entry in the hash table. The function is
49+
expected to take the entry's value as its only argument and return an
50+
int. If the function returns a negative int the loop is aborted
51+
immediately. Otherwise, the return value is accumulated and the sum
52+
returned upon completion of the loop.

Documentation/technical/api-strbuf.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ strbuf API actually relies on the string being free of NULs.
1212

1313
strbufs has some invariants that are very important to keep in mind:
1414

15-
. The `buf` member is never NULL, so you it can be used in any usual C
15+
. The `buf` member is never NULL, so it can be used in any usual C
1616
string operations safely. strbuf's _have_ to be initialized either by
1717
`strbuf_init()` or by `= STRBUF_INIT` before the invariants, though.
1818
+
@@ -55,7 +55,7 @@ Data structures
5555

5656
* `struct strbuf`
5757

58-
This is string buffer structure. The `len` member can be used to
58+
This is the string buffer structure. The `len` member can be used to
5959
determine the current length of the string, and `buf` member provides access to
6060
the string itself.
6161

@@ -253,3 +253,9 @@ same behaviour as well.
253253
comments are considered contents to be removed or not.
254254

255255
`launch_editor`::
256+
257+
Launch the user preferred editor to edit a file and fill the buffer
258+
with the file's contents upon the user completing their editing. The
259+
third argument can be used to set the environment which the editor is
260+
run in. If the buffer is NULL the editor is launched as usual but the
261+
file's contents are not read into the buffer upon completion.

git-rebase--interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ EOF
779779

780780
cp "$TODO" "$TODO".backup
781781
git_editor "$TODO" ||
782-
die "Could not execute editor"
782+
die_abort "Could not execute editor"
783783

784784
has_action "$TODO" ||
785785
die_abort "Nothing to do"

0 commit comments

Comments
 (0)