Git fork

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

Code clean-up.

* rs/use-xopen-in-index-pack:
index-pack: use xopen in init_thread

+9 -8
+1 -3
builtin/index-pack.c
··· 188 188 pthread_key_create(&key, NULL); 189 189 CALLOC_ARRAY(thread_data, nr_threads); 190 190 for (i = 0; i < nr_threads; i++) { 191 - thread_data[i].pack_fd = open(curr_pack, O_RDONLY); 192 - if (thread_data[i].pack_fd == -1) 193 - die_errno(_("unable to open %s"), curr_pack); 191 + thread_data[i].pack_fd = xopen(curr_pack, O_RDONLY); 194 192 } 195 193 196 194 threads_active = 1;
+8 -5
contrib/coccinelle/xopen.cocci
··· 2 2 identifier fd; 3 3 identifier die_fn =~ "^(die|die_errno)$"; 4 4 @@ 5 - ( 6 - fd = 5 + int fd = 7 6 - open 8 7 + xopen 9 8 (...); 10 - | 11 - int fd = 9 + - if ( \( fd < 0 \| fd == -1 \) ) { die_fn(...); } 10 + 11 + @@ 12 + expression fd; 13 + identifier die_fn =~ "^(die|die_errno)$"; 14 + @@ 15 + fd = 12 16 - open 13 17 + xopen 14 18 (...); 15 - ) 16 19 - if ( \( fd < 0 \| fd == -1 \) ) { die_fn(...); }