Skip to content

Commit

Permalink
global: Replace buffer_get_used_size(buf) with buf->used
Browse files Browse the repository at this point in the history
Doesn't make any diffence to code generation, but it's somewhat simpler code.
It's also more consistent since most of the code nowadays uses the ->used.
  • Loading branch information
sirainen authored and GitLab committed May 3, 2016
1 parent 26a6ff7 commit 2d5d789
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/auth/mech-rpa.c
Expand Up @@ -381,7 +381,7 @@ mech_rpa_build_token2(struct rpa_auth_request *request, size_t *size)
buffer_append_c(buf, realms_len & 0xff);
buffer_append(buf, str_c(realms), realms_len);

*size = buffer_get_used_size(buf);
*size = buf->used;
return buffer_free_without_data(&buf);
}

Expand Down Expand Up @@ -414,7 +414,7 @@ mech_rpa_build_token4(struct rpa_auth_request *request, size_t *size)
/* Status, 0 - success */
buffer_append_c(buf, 0);

*size = buffer_get_used_size(buf);
*size = buf->used;
return buffer_free_without_data(&buf);
}

Expand Down
2 changes: 1 addition & 1 deletion src/auth/password-scheme-rpa.c
Expand Up @@ -20,7 +20,7 @@ void *ucs2be_str(pool_t pool, const char *str, size_t *size)
buffer_append_c(buf, *str++);
}

*size = buffer_get_used_size(buf);
*size = buf->used;
return buffer_free_without_data(&buf);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib-index/mail-transaction-log-file.c
Expand Up @@ -1461,7 +1461,7 @@ mail_transaction_log_file_read_more(struct mail_transaction_log_file *file)
uint32_t read_offset;
ssize_t ret;

read_offset = file->buffer_offset + buffer_get_used_size(file->buffer);
read_offset = file->buffer_offset + file->buffer->used;

do {
data = buffer_append_space_unsafe(file->buffer, LOG_PREFETCH);
Expand Down Expand Up @@ -1707,7 +1707,7 @@ int mail_transaction_log_file_map(struct mail_transaction_log_file *file,

if (file->buffer != NULL && file->buffer_offset <= start_offset) {
/* see if we already have it */
size = buffer_get_used_size(file->buffer);
size = file->buffer->used;
if (file->buffer_offset + size >= end_offset)
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib-mail/message-part-serialize.c
Expand Up @@ -73,7 +73,7 @@ static void part_serialize(struct message_part *part, buffer_t *dest,

if ((part->flags & (MESSAGE_PART_FLAG_MULTIPART |
MESSAGE_PART_FLAG_MESSAGE_RFC822)) != 0) {
children_offset = buffer_get_used_size(dest);
children_offset = dest->used;
children_count = 0;
buffer_append(dest, &children_count,
sizeof(children_count));
Expand Down
2 changes: 1 addition & 1 deletion src/lib-ntlm/ntlm-encrypt.c
Expand Up @@ -29,7 +29,7 @@ t_unicode_str(const char *src, bool ucase, size_t *size)
buffer_append_c(wstr, '\0');
}

*size = buffer_get_used_size(wstr);
*size = wstr->used;
return buffer_free_without_data(&wstr);
}

Expand Down
6 changes: 3 additions & 3 deletions src/lib-ntlm/ntlm-message.c
Expand Up @@ -61,7 +61,7 @@ static void ntlmssp_append_string(buffer_t *buf, size_t buffer_offset,
struct ntlmssp_buffer buffer;
unsigned int length;

write_le32(&buffer.offset, buffer_get_used_size(buf));
write_le32(&buffer.offset, buf->used);

length = append_string(buf, str, FALSE, unicode);

Expand All @@ -78,7 +78,7 @@ static void ntlmssp_append_target_info(buffer_t *buf, size_t buffer_offset, ...)
unsigned int length, total_length = 0;
int type;

write_le32(&buffer.offset, buffer_get_used_size(buf));
write_le32(&buffer.offset, buf->used);

va_start(args, buffer_offset);

Expand Down Expand Up @@ -169,7 +169,7 @@ ntlmssp_create_challenge(pool_t pool, const struct ntlmssp_request *request,
NTPLMSSP_V2_TARGET_FQDN, my_hostname,
NTPLMSSP_V2_TARGET_END);

*size = buffer_get_used_size(buf);
*size = buf->used;
return buffer_free_without_data(&buf);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/str.c
Expand Up @@ -80,7 +80,7 @@ char *str_c_modifiable(string_t *str)

size_t str_len(const string_t *str)
{
return buffer_get_used_size(str);
return str->used;
}

bool str_equals(const string_t *str1, const string_t *str2)
Expand Down

0 comments on commit 2d5d789

Please sign in to comment.