memzap

replay memory writes
git clone git://git.2f30.org/memzap
Log | Files | Refs | README | LICENSE

commit cc64bc54f09eb94a4e135ec7051f6b22f5f782ba
parent c62300609a6eeb8e01a9caf0800b831887d861a6
Author: sin <sin@2f30.org>
Date:   Sun,  3 Mar 2013 21:45:24 +0000

Stylistic changes

Diffstat:
Mmdiff.c | 4+++-
Mmem.c | 2--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mdiff.c b/mdiff.c @@ -108,6 +108,7 @@ mdiff_read_diff(int fd, struct mdiff_hdr *hdr, uint32_t region) ret = lseek(fd, offset, SEEK_SET); if (ret < 0) err(1, "lseek"); + mdiff = xmalloc(sizeof(*mdiff)); for (i = 0; i < region; i++) { ret = read(fd, mdiff, sizeof(*mdiff)); @@ -123,9 +124,11 @@ mdiff_read_diff(int fd, struct mdiff_hdr *hdr, uint32_t region) ret = read(fd, mdiff, sizeof(*mdiff)); if (ret != sizeof(*mdiff)) err(1, "read"); + ret = lseek(fd, offset, SEEK_SET); if (ret < 0) err(1, "lseek"); + len = mdiff->len; mdiff = xrealloc(mdiff, sizeof(*mdiff) + len); ret = read(fd, mdiff, sizeof(*mdiff) + len); @@ -163,7 +166,6 @@ mdiff_append_rdiff(int fd, struct mem_region_diff *rdiff) if (ret != (ssize_t)md->len) err(1, "write"); } - return 0; } diff --git a/mem.c b/mem.c @@ -280,7 +280,6 @@ diff_mem_region(struct mem_tree *dst, rdiff->nmrdiffs++; } } - return rdiff; } @@ -308,7 +307,6 @@ apply_diff(struct mem_region *dst, /* Patch it! */ memcpy(mb->buf, mdiff->buf, mb->len); } - return dst; }