aboutsummaryrefslogtreecommitdiffstats
path: root/dos
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:32 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:32 -0700
commit2c8ebb1f98597641aa1b3dd3efbde74c1d451261 (patch)
treed8fe679ddfbd290c4b4d6d5065883b20546a6a08 /dos
parentc9025d60139ae23a208baa85a8739654ac02fe56 (diff)
downloadsyslinux-devel-2c8ebb1f98597641aa1b3dd3efbde74c1d451261.tar.gz
syslinux-devel-2c8ebb1f98597641aa1b3dd3efbde74c1d451261.tar.xz
syslinux-devel-2c8ebb1f98597641aa1b3dd3efbde74c1d451261.zip
Run Nindent on dos/free.c
Automatically reformat dos/free.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'dos')
-rw-r--r--dos/free.c93
1 files changed, 46 insertions, 47 deletions
diff --git a/dos/free.c b/dos/free.c
index aa17080d..020dc157 100644
--- a/dos/free.c
+++ b/dos/free.c
@@ -7,72 +7,71 @@
#include <stdlib.h>
#include "malloc.h"
-static struct free_arena_header *
-__free_block(struct free_arena_header *ah)
+static struct free_arena_header *__free_block(struct free_arena_header *ah)
{
- struct free_arena_header *pah, *nah;
+ struct free_arena_header *pah, *nah;
- pah = ah->a.prev;
- nah = ah->a.next;
- if ( pah->a.type == ARENA_TYPE_FREE &&
- (char *)pah+pah->a.size == (char *)ah ) {
- /* Coalesce into the previous block */
- pah->a.size += ah->a.size;
- pah->a.next = nah;
- nah->a.prev = pah;
+ pah = ah->a.prev;
+ nah = ah->a.next;
+ if (pah->a.type == ARENA_TYPE_FREE &&
+ (char *)pah + pah->a.size == (char *)ah) {
+ /* Coalesce into the previous block */
+ pah->a.size += ah->a.size;
+ pah->a.next = nah;
+ nah->a.prev = pah;
#ifdef DEBUG_MALLOC
- ah->a.type = ARENA_TYPE_DEAD;
+ ah->a.type = ARENA_TYPE_DEAD;
#endif
- ah = pah;
- pah = ah->a.prev;
- } else {
- /* Need to add this block to the free chain */
- ah->a.type = ARENA_TYPE_FREE;
-
- ah->next_free = __malloc_head.next_free;
- ah->prev_free = &__malloc_head;
- __malloc_head.next_free = ah;
- ah->next_free->prev_free = ah;
- }
-
- /* In either of the previous cases, we might be able to merge
- with the subsequent block... */
- if ( nah->a.type == ARENA_TYPE_FREE &&
- (char *)ah+ah->a.size == (char *)nah ) {
- ah->a.size += nah->a.size;
-
- /* Remove the old block from the chains */
- nah->next_free->prev_free = nah->prev_free;
- nah->prev_free->next_free = nah->next_free;
- ah->a.next = nah->a.next;
- nah->a.next->a.prev = ah;
+ ah = pah;
+ pah = ah->a.prev;
+ } else {
+ /* Need to add this block to the free chain */
+ ah->a.type = ARENA_TYPE_FREE;
+
+ ah->next_free = __malloc_head.next_free;
+ ah->prev_free = &__malloc_head;
+ __malloc_head.next_free = ah;
+ ah->next_free->prev_free = ah;
+ }
+
+ /* In either of the previous cases, we might be able to merge
+ with the subsequent block... */
+ if (nah->a.type == ARENA_TYPE_FREE &&
+ (char *)ah + ah->a.size == (char *)nah) {
+ ah->a.size += nah->a.size;
+
+ /* Remove the old block from the chains */
+ nah->next_free->prev_free = nah->prev_free;
+ nah->prev_free->next_free = nah->next_free;
+ ah->a.next = nah->a.next;
+ nah->a.next->a.prev = ah;
#ifdef DEBUG_MALLOC
- nah->a.type = ARENA_TYPE_DEAD;
+ nah->a.type = ARENA_TYPE_DEAD;
#endif
- }
+ }
- /* Return the block that contains the called block */
- return ah;
+ /* Return the block that contains the called block */
+ return ah;
}
void free(void *ptr)
{
- struct free_arena_header *ah;
+ struct free_arena_header *ah;
- if ( !ptr )
- return;
+ if (!ptr)
+ return;
- ah = (struct free_arena_header *)
- ((struct arena_header *)ptr - 1);
+ ah = (struct free_arena_header *)
+ ((struct arena_header *)ptr - 1);
#ifdef DEBUG_MALLOC
- assert( ah->a.type == ARENA_TYPE_USED );
+ assert(ah->a.type == ARENA_TYPE_USED);
#endif
- __free_block(ah);
+ __free_block(ah);
- /* Here we could insert code to return memory to the system. */
+ /* Here we could insert code to return memory to the system. */
}