Skip to content

Commit

Permalink
smol cleanup in stream_read_compare()
Browse files Browse the repository at this point in the history
  • Loading branch information
vampirefrog committed Jun 22, 2024
1 parent 1e1c029 commit 2b6ac4d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,10 @@ ssize_t stream_write_big_uint32(struct stream *stream, uint32_t i) {
int stream_read_compare(struct stream *stream, const void *data, size_t len) {
if(!len) len = strlen((char *)data);
void *buf = malloc(len);
if(buf) {
int ret = !(stream_read(stream, buf, len) < len || memcmp(buf, data, len));
free(buf);
return ret;
}
return 0;
if(!buf) return 0;
int ret = !(stream_read(stream, buf, len) < len || memcmp(buf, data, len));
free(buf);
return ret;
}

static size_t mem_stream_read(struct stream *stream, void *ptr, size_t size) {
Expand Down

0 comments on commit 2b6ac4d

Please sign in to comment.