From 76252305f990c960de08d6793da96a2f0e3a2765 Mon Sep 17 00:00:00 2001 From: DTB Date: Wed, 3 Jul 2024 14:46:56 -0600 Subject: [PATCH] dj(1): remove Io_bufalloc --- src/dj.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/dj.c b/src/dj.c index e5f276b..2e565ce 100644 --- a/src/dj.c +++ b/src/dj.c @@ -65,15 +65,6 @@ static int write_flags = O_WRONLY | O_CREAT; || (fd) == STDOUT_FILENO \ || (fd) == STDERR_FILENO) -/* Allocates *io's buffer. Returns NULL if unsuccessful. */ -static void * -Io_bufalloc(struct Io *io){ - - return io != NULL - ? (io->buf = malloc(io->bs * (sizeof *io->buf))) - : NULL; -} - /* Fills the unused portion of io's buffer with padding, updating io->bufuse. * Returns io. */ static struct Io * @@ -324,7 +315,7 @@ int main(int argc, char *argv[]){ } for(i = 0; i < 2; ++i){ - if(Io_bufalloc(&io[i]) == NULL){ + if((io[i].buf = malloc(io[i].bs * (sizeof *(io[i].buf)))) == NULL){ fprintf(stderr, "%s: Failed to allocate %d bytes\n", program_name, io[i].bs); return EX_OSERR;