From 2b593559afc64ad2a7f80bed0511e19250ade41d Mon Sep 17 00:00:00 2001 From: DTB Date: Wed, 3 Jul 2024 19:06:59 -0600 Subject: [PATCH] dj(1): remove Io_bufrpad --- src/dj.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/dj.c b/src/dj.c index 22c46a7..6815a82 100644 --- a/src/dj.c +++ b/src/dj.c @@ -62,19 +62,6 @@ static int write_flags = O_WRONLY | O_CREAT; /* Macro to check if fd is stdin or stdout */ #define fdisstd(fd) ((fd) == STDIN_FILENO || (fd) == STDOUT_FILENO) -/* Fills the unused portion of io's buffer with padding, updating io->bufuse. - * Returns io. */ -static struct Io * -Io_bufrpad(struct Io *io, int padding){ - - assert(io != NULL); - - memset(io->buf + io->bufuse, padding, io->bs - io->bufuse); - io->bufuse = io->bs; - - return io; -} - /* Opens io->fn and saves the file descriptor into io->fd. Returns io->fd, * which will be -1 if an error occured. */ static int @@ -294,8 +281,12 @@ int main(int argc, char *argv[]){ printio(fmt, io); if(!noerror) count = 1; - if(align >= 0) - Io_bufrpad(&io[0], align); + if(align >= 0){ + /* fill the rest of the ibuf with padding */ + memset(io[0].buf + io[0].bufuse, align, + io[0].bs - io[0].bufuse); + io->bufuse = io->bs; + } }else ++io[0].rec;