1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-10 15:26:09 +02:00

Merge branch 'rs/use-xopen-in-index-pack'

Code clean-up.

* rs/use-xopen-in-index-pack:
  index-pack: use xopen in init_thread
This commit is contained in:
Junio C Hamano 2021-09-23 13:44:50 -07:00
commit b1b065ee35
2 changed files with 11 additions and 10 deletions

View File

@ -188,9 +188,7 @@ static void init_thread(void)
pthread_key_create(&key, NULL);
CALLOC_ARRAY(thread_data, nr_threads);
for (i = 0; i < nr_threads; i++) {
thread_data[i].pack_fd = open(curr_pack, O_RDONLY);
if (thread_data[i].pack_fd == -1)
die_errno(_("unable to open %s"), curr_pack);
thread_data[i].pack_fd = xopen(curr_pack, O_RDONLY);
}
threads_active = 1;

View File

@ -2,15 +2,18 @@
identifier fd;
identifier die_fn =~ "^(die|die_errno)$";
@@
(
fd =
- open
+ xopen
(...);
|
int fd =
- open
+ xopen
(...);
)
- if ( \( fd < 0 \| fd == -1 \) ) { die_fn(...); }
@@
expression fd;
identifier die_fn =~ "^(die|die_errno)$";
@@
fd =
- open
+ xopen
(...);
- if ( \( fd < 0 \| fd == -1 \) ) { die_fn(...); }