summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2021-04-02 08:41:50 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2021-04-02 08:41:50 +0000
commitdba7d25709e781c8fb2a6afbb45e63b2c1af8e13 (patch)
treeb2acb2fd980451232c55ed480615a1c74dfed4ca /Build
parenta5a79ac24cd961db574a888f2a7888046f8124f7 (diff)
[CTIE] More concise 'find/fopen' logic.
git-svn-id: svn://tug.org/texlive/trunk@58700 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/ctiedir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/ctiedir/ctie-k.ch44
2 files changed, 21 insertions, 27 deletions
diff --git a/Build/source/texk/web2c/ctiedir/ChangeLog b/Build/source/texk/web2c/ctiedir/ChangeLog
index 74c3f1e9386..732e882ea3b 100644
--- a/Build/source/texk/web2c/ctiedir/ChangeLog
+++ b/Build/source/texk/web2c/ctiedir/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-10 Andreas Scherer <https://ascherer.github.io>
+
+ * ctie-k.ch: More concise 'find/fopen' logic.
+
2020-07-24 Andreas Scherer <https://ascherer.github.io>
* ctie-k.ch: Format types in boldface prior to their definition.
diff --git a/Build/source/texk/web2c/ctiedir/ctie-k.ch b/Build/source/texk/web2c/ctiedir/ctie-k.ch
index ccd8f157b59..e9ac5959b6e 100644
--- a/Build/source/texk/web2c/ctiedir/ctie-k.ch
+++ b/Build/source/texk/web2c/ctiedir/ctie-k.ch
@@ -329,10 +329,8 @@ variable) to search for this file.@.CWEBINPUTS@>
@x l.534 Replace with kpse_find_file
if ((new_inc->the_file=fopen(new_inc->file_name, "r"))!=NULL) {
@y
- fullname=kpse_find_cweb(new_inc->file_name);
- if (fullname)
- new_inc->the_file=fopen(fullname, "r");
- if (fullname!=NULL && new_inc->the_file!=NULL) {
+ if ((fullname=kpse_find_cweb(new_inc->file_name))!=NULL @|
+ && (new_inc->the_file=fopen(fullname, "r"))!=NULL) {
free(fullname);
@z
@@ -434,8 +432,9 @@ interface.
@x l.731 Use binary mode for output files
out_file=fopen(out_name, "w");
+ if (out_file==NULL) {
@y
- out_file=fopen(out_name, "wb");
+ if ((out_file=fopen(out_name, "wb"))==NULL) {
@z
@x l.739
@@ -466,20 +465,15 @@ the file.
{
string fullname;
- fullname = kpse_find_cweb(input_organisation[0]->file_name);
- if (fullname)
- input_organisation[0]->the_file = fopen(fullname, "r");
-
- if (fullname==NULL || input_organisation[0]->the_file==NULL) {
- if (fullname) {
+ if ((fullname = kpse_find_cweb(input_organisation[0]->file_name))!=NULL) {
+ if ((input_organisation[0]->the_file = fopen(fullname, "r"))==NULL)
pfatal_error("! Cannot open master file ",
input_organisation[0]->file_name);
- } else {
- fatal_error(-1, "! Cannot find master file ",
- input_organisation[0]->file_name);
- }
+ free(fullname);
+ } @+ else {
+ fatal_error(-1, "! Cannot find master file ",
+ input_organisation[0]->file_name);
}
- else free(fullname);
@.Cannot open master file@>
@.Cannot find master file@>
@z
@@ -505,20 +499,16 @@ the file.
i=1;
while (i<no_ch) {
- fullname = kpse_find_cweb(input_organisation[i]->file_name);
- if (fullname)
- input_organisation[i]->the_file = fopen(fullname, "r");
-
- if (fullname==NULL || input_organisation[i]->the_file==NULL) {
- if (fullname) {
+ if ((fullname = kpse_find_cweb(input_organisation[i]->file_name))
+ !=NULL) {
+ if ((input_organisation[i]->the_file = fopen(fullname, "r"))==NULL)
pfatal_error("! Cannot open change file ",
input_organisation[i]->file_name);
- } else {
- fatal_error(-1, "! Cannot find change file ",
- input_organisation[i]->file_name);
- }
+ free(fullname);
+ } @+ else {
+ fatal_error(-1, "! Cannot find change file ",
+ input_organisation[i]->file_name);
}
- else free(fullname);
@.Cannot open change file@>
@.Cannot find change file@>
@z