From 4be6e0ce91c0690d3cbf58bd7b76144e01fe2be7 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 30 Aug 2021 18:11:51 +0200 Subject: blaze822: remove blaze822_mmap, never used. --- blaze822.c | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) (limited to 'blaze822.c') diff --git a/blaze822.c b/blaze822.c index d3e17f0..e55ae49 100644 --- a/blaze822.c +++ b/blaze822.c @@ -664,55 +664,6 @@ error: return 0; } -struct message * -blaze822_mmap(char *file) -{ - int fd = open(file, O_RDONLY); - if (fd < 0) - return 0; - - struct stat st; - if (fstat(fd, &st) < 0) - goto error; - - size_t len = st.st_size; - - struct message *mesg = malloc(sizeof (struct message)); - if (!mesg) - goto error; - - char *buf = mmap(0, len+1, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); - if (buf == MAP_FAILED) { - free(mesg); - perror("mmap"); - goto error; - } - close(fd); - - char *end; - if ((end = mymemmem(buf, len, "\n\n", 2))) { - mesg->body = end+2; - } else if ((end = mymemmem(buf, len, "\r\n\r\n", 4))) { - mesg->body = end+4; - } else { - end = buf + len; - mesg->body = end; - } - - unfold_hdr(buf, end); - - mesg->msg = mesg->bodychunk = buf; - mesg->end = end; - mesg->bodyend = buf + len; - mesg->orig_header = 0; - - return mesg; - -error: - close(fd); - return 0; -} - size_t blaze822_headerlen(struct message *mesg) { -- cgit 1.4.1