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
Родитель d1e376d2f9 6346f704a0
Коммит b1b065ee35
2 изменённых файлов: 11 добавлений и 10 удалений

Просмотреть файл

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

Просмотреть файл

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