2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
12 /* This code is in the public domain.
13 ** Version: 1.1 Author: Walt Karas
16 #include "hmm_intrnl.h"
18 void U(grow_chunk
)(U(descriptor
) *desc
, void *end
, U(size_bau
) n_baus
)
21 #define HEAD_PTR ((head_record *) end)
23 end
= BAUS_BACKWARD(end
, DUMMY_END_BLOCK_BAUS
);
27 if (HEAD_PTR
->block_size
!= 0)
28 /* Chunk does not have valid dummy end block. */
33 /* Create a new block that absorbs the old dummy end block. */
34 HEAD_PTR
->block_size
= n_baus
;
36 /* Set up the new dummy end block. */
38 head_record
*dummy
= (head_record
*) BAUS_FORWARD(end
, n_baus
);
39 dummy
->previous_block_size
= n_baus
;
40 dummy
->block_size
= 0;
43 /* Simply free the new block, allowing it to coalesce with any
44 ** free block at that was the last block in the chunk prior to
47 U(free
)(desc
, HEAD_TO_PTR_REC(end
));