diff options
Diffstat (limited to 'ot_iovec.c')
| -rw-r--r-- | ot_iovec.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -12,7 +12,7 @@ | |||
| 12 | /* Opentracker */ | 12 | /* Opentracker */ |
| 13 | #include "ot_iovec.h" | 13 | #include "ot_iovec.h" |
| 14 | 14 | ||
| 15 | void *iovec_increase(size_t *iovec_entries, struct iovec **iovector, size_t new_alloc) { | 15 | void *iovec_new_chunk(size_t *iovec_entries, struct iovec **iovector, size_t new_alloc) { |
| 16 | void *new_data; | 16 | void *new_data; |
| 17 | size_t new_entries = 1 + *iovec_entries; | 17 | size_t new_entries = 1 + *iovec_entries; |
| 18 | struct iovec *new_vec = realloc(*iovector, new_entries * sizeof(struct iovec)); | 18 | struct iovec *new_vec = realloc(*iovector, new_entries * sizeof(struct iovec)); |
| @@ -62,7 +62,7 @@ void iovec_free(size_t *iovec_entries, struct iovec **iovector) { | |||
| 62 | *iovec_entries = 0; | 62 | *iovec_entries = 0; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | void iovec_fixlast(size_t *iovec_entries, struct iovec **iovector, void *last_ptr) { | 65 | void iovec_trim_last(size_t *iovec_entries, struct iovec **iovector, void *last_ptr) { |
| 66 | if (*iovec_entries) { | 66 | if (*iovec_entries) { |
| 67 | char *base = (char *)((*iovector)[*iovec_entries - 1]).iov_base; | 67 | char *base = (char *)((*iovector)[*iovec_entries - 1]).iov_base; |
| 68 | size_t new_alloc = ((char *)last_ptr) - base; | 68 | size_t new_alloc = ((char *)last_ptr) - base; |
| @@ -72,12 +72,12 @@ void iovec_fixlast(size_t *iovec_entries, struct iovec **iovector, void *last_pt | |||
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | void *iovec_fix_increase_or_free(size_t *iovec_entries, struct iovec **iovector, void *last_ptr, size_t new_alloc) { | 75 | void *iovec_next_chunk(size_t *iovec_entries, struct iovec **iovector, void *last_ptr, size_t new_alloc) { |
| 76 | void *new_data; | 76 | void *new_data; |
| 77 | 77 | ||
| 78 | iovec_fixlast(iovec_entries, iovector, last_ptr); | 78 | iovec_trim_last(iovec_entries, iovector, last_ptr); |
| 79 | 79 | ||
| 80 | if (!(new_data = iovec_increase(iovec_entries, iovector, new_alloc))) | 80 | if (!(new_data = iovec_new_chunk(iovec_entries, iovector, new_alloc))) |
| 81 | iovec_free(iovec_entries, iovector); | 81 | iovec_free(iovec_entries, iovector); |
| 82 | 82 | ||
| 83 | return new_data; | 83 | return new_data; |
