6346f704a0
Support an arbitrary file descriptor expression in the semantic patch for replacing open+die_errno with xopen, not just an identifier, and apply it. This makes the error message at the single affected place more consistent and reduces code duplication. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 lines
295 B
Plaintext
20 lines
295 B
Plaintext
@@
|
|
identifier fd;
|
|
identifier die_fn =~ "^(die|die_errno)$";
|
|
@@
|
|
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(...); }
|