Skip to content

Commit 777adb1

Browse files
committed
A few style cleanups.
1 parent 05b51bc commit 777adb1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

bson/buffer.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,20 @@ int buffer_free(buffer_t buffer) {
6161
/* Grow `buffer` to at least `min_length`.
6262
* Return non-zero on allocation failure. */
6363
static int buffer_grow(buffer_t buffer, int min_length) {
64+
int old_size = 0;
6465
int size = buffer->size;
6566
char* old_buffer = buffer->buffer;
6667
if (size >= min_length) {
6768
return 0;
6869
}
6970
while (size < min_length) {
70-
int old_size = size;
71+
old_size = size;
7172
size *= 2;
7273
if (size <= old_size) {
73-
/* size did not increase. Could be an overflow or size < 1. Just go with min_length */
74+
/* Size did not increase. Could be an overflow
75+
* or size < 1. Just go with min_length. */
7476
size = min_length;
75-
}
77+
}
7678
}
7779
buffer->buffer = (char*)realloc(buffer->buffer, sizeof(char) * size);
7880
if (buffer->buffer == NULL) {

0 commit comments

Comments
 (0)