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 ------------------------------------------------- blaze822.h | 1 - 2 files changed, 50 deletions(-) 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) { diff --git a/blaze822.h b/blaze822.h index 9aae8a5..ad5cc76 100644 --- a/blaze822.h +++ b/blaze822.h @@ -14,7 +14,6 @@ struct message; struct message *blaze822(char *file); // just header struct message *blaze822_file(char *file); // header + body (read(2)) -struct message *blaze822_mmap(char *file); // header + body (mmap(2)) struct message *blaze822_mem(char *buf, size_t len); // header + body char *blaze822_hdr_(struct message *mesg, const char *hdr, size_t len); -- cgit 1.4.1