chiark / gitweb /
regress: playback: Fold other Tensure calls into Tensuresetup
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 30 Nov 2016 18:36:33 +0000 (18:36 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 11 Jun 2020 15:13:02 +0000 (16:13 +0100)
Rename Tensurereportfile and Tensurefuzzrawfile to be sure we didn't
miss any diredct call sites.

No significant functional change; we just do all of the idempotent
setup at each point.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
regress/hplayback.c.m4

index e0aba98543f8b8d97aeaf53b7120bc9b91419005..4fb12044e73b130d2bda88ce7819b707b0f8ca11 100644 (file)
@@ -45,7 +45,7 @@ m4_include(hmacros.i4)
 static FILE *Tinputfile, *Tfuzzrawfile, *Treportfile;
 static vbuf vb2;
 
 static FILE *Tinputfile, *Tfuzzrawfile, *Treportfile;
 static vbuf vb2;
 
-static void Tensurereportfile(void) {
+static void Tensure_reportfile(void) {
   const char *fdstr;
   int fd;
 
   const char *fdstr;
   int fd;
 
@@ -56,7 +56,7 @@ static void Tensurereportfile(void) {
   Treportfile= fdopen(fd,"a"); if (!Treportfile) Tfailed("fdopen ADNS_TEST_REPORT_FD");
 }
 
   Treportfile= fdopen(fd,"a"); if (!Treportfile) Tfailed("fdopen ADNS_TEST_REPORT_FD");
 }
 
-static void Tensurefuzzrawfile(void) {
+static void Tensure_fuzzrawfile(void) {
   static int done;
 
   if (done) return;
   static int done;
 
   if (done) return;
@@ -110,6 +110,9 @@ void Tensuresetup(void) {
   int chars;
   unsigned long sec, usec;
 
   int chars;
   unsigned long sec, usec;
 
+  Tensure_reportfile();
+  Tensure_fuzzrawfile();
+
   if (Tinputfile) return;
   Tinputfile= stdin;
   fd = Ttestinputfd();
   if (Tinputfile) return;
   Tinputfile= stdin;
   fd = Ttestinputfd();
@@ -356,7 +359,6 @@ void Q_vb(void) {
             vb.used,vb.buf, vb.used,vb2.buf+1);
     exit(1);
   }
             vb.used,vb.buf, vb.used,vb2.buf+1);
     exit(1);
   }
-  Tensurereportfile();
   nl= memchr(vb.buf,'\n',vb.used);
   fprintf(Treportfile," %.*s\n", (int)(nl ? nl - (const char*)vb.buf : vb.used), vb.buf);
 }
   nl= memchr(vb.buf,'\n',vb.used);
   fprintf(Treportfile," %.*s\n", (int)(nl ? nl - (const char*)vb.buf : vb.used), vb.buf);
 }
@@ -383,8 +385,7 @@ int H$1(hm_args_massage($3,void)) {
  if (!adns__vbuf_ensure(&vb2,1000)) Tnomem();
  fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput();
 
  if (!adns__vbuf_ensure(&vb2,1000)) Tnomem();
  fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput();
 
- Tensurereportfile();
- Tensurefuzzrawfile();
+ Tensuresetup();
  fprintf(Treportfile,"%s",vb2.buf);
  amtread= strlen(vb2.buf);
  if (amtread<=0 || vb2.buf[--amtread]!=hm_squote\nhm_squote)
  fprintf(Treportfile,"%s",vb2.buf);
  amtread= strlen(vb2.buf);
  if (amtread<=0 || vb2.buf[--amtread]!=hm_squote\nhm_squote)