From: Ian Jackson Date: Fri, 11 Sep 2026 12:19:46 +0000 (+0100) Subject: regress/hplayback: Break out Pfgets X-Git-Tag: adns-1.7.0~6 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=36217dbde29c49a285a1549ef09349a425644210;p=adns.git regress/hplayback: Break out Pfgets This is more DRY and allows us to try to suppress an unused return value warning. --- diff --git a/regress/hplayback.c.m4 b/regress/hplayback.c.m4 index 7e688bf..4fd9b5c 100644 --- a/regress/hplayback.c.m4 +++ b/regress/hplayback.c.m4 @@ -92,6 +92,12 @@ static void Pcheckinput(void) { if (feof(Tinputfile)) Psyntax("eof at syscall reply"); } + +static void Pfgets(void *buf, int size) { + (void)fgets(buf,size,Tinputfile); + Pcheckinput(); +} + void T_gettimeofday_hook(void) { static struct timeval previously; struct timeval delta; @@ -118,7 +124,7 @@ void Tensuresetup(void) { setvbuf(Tinputfile,0,_IONBF,0); if (!adns__vbuf_ensure(&vb2,1000)) Tnomem(); - fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput(); + Pfgets(vb2.buf,vb2.avail); chars= -1; sscanf(vb2.buf," start %lu.%lu%n",&sec,&usec,&chars); if (chars==-1) Psyntax("start time invalid"); @@ -170,7 +176,7 @@ static void P_updatetime(void) { long usec; if (!adns__vbuf_ensure(&vb2,1000)) Tnomem(); - fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput(); + Pfgets(vb2.buf,vb2.avail); chars= -1; sscanf(vb2.buf," +%lu.%ld%n",&sec,&usec,&chars); if (chars==-1) Psyntax("update time invalid"); @@ -388,7 +394,7 @@ int H$1(hm_args_massage($3,void)) { m4_define(`hm_r_offset',`m4_len(` $1=')') if (!adns__vbuf_ensure(&vb2,1000)) Tnomem(); - fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput(); + Pfgets(vb2.buf,vb2.avail); Tensuresetup(); fprintf(Treportfile,"%s",vb2.buf);