dj(1): remove Io_bufalloc

This commit is contained in:
dtb 2024-07-03 14:46:56 -06:00
parent 1cf67af281
commit 76252305f9
Signed by: trinity
GPG Key ID: 34C0543BBB6AF81B

View File

@ -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;