texlive[58700] Build/source/texk/web2c/ctiedir: [CTIE] More concise

commits+ascherer at tug.org commits+ascherer at tug.org
Fri Apr 2 10:41:50 CEST 2021


Revision: 58700
          http://tug.org/svn/texlive?view=revision&revision=58700
Author:   ascherer
Date:     2021-04-02 10:41:50 +0200 (Fri, 02 Apr 2021)
Log Message:
-----------
[CTIE] More concise 'find/fopen' logic.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ctiedir/ChangeLog
    trunk/Build/source/texk/web2c/ctiedir/ctie-k.ch

Modified: trunk/Build/source/texk/web2c/ctiedir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ctiedir/ChangeLog	2021-04-02 07:57:25 UTC (rev 58699)
+++ trunk/Build/source/texk/web2c/ctiedir/ChangeLog	2021-04-02 08:41:50 UTC (rev 58700)
@@ -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.

Modified: trunk/Build/source/texk/web2c/ctiedir/ctie-k.ch
===================================================================
--- trunk/Build/source/texk/web2c/ctiedir/ctie-k.ch	2021-04-02 07:57:25 UTC (rev 58699)
+++ trunk/Build/source/texk/web2c/ctiedir/ctie-k.ch	2021-04-02 08:41:50 UTC (rev 58700)
@@ -329,10 +329,8 @@
 @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 @@
 
 @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 @@
 {
     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 @@
 
     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



More information about the tex-live-commits mailing list.