diff options
author | Leah Neukirchen <leah@vuxu.org> | 2021-08-30 18:11:51 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2021-08-30 18:12:09 +0200 |
commit | 4be6e0ce91c0690d3cbf58bd7b76144e01fe2be7 (patch) | |
tree | 87097d30e4fa0043a8436583bfe881f0925ffe35 | |
parent | 4ccf2f08c1aa8b15f31ac469edebe6c4710d74f1 (diff) | |
download | mblaze-4be6e0ce91c0690d3cbf58bd7b76144e01fe2be7.tar.gz mblaze-4be6e0ce91c0690d3cbf58bd7b76144e01fe2be7.tar.xz mblaze-4be6e0ce91c0690d3cbf58bd7b76144e01fe2be7.zip |
blaze822: remove blaze822_mmap, never used.
-rw-r--r-- | blaze822.c | 49 | ||||
-rw-r--r-- | blaze822.h | 1 |
2 files changed, 0 insertions, 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); |