Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-10-28 09:00:00 +0400
committerChristopher Faylor <me@cgf.cx>2000-10-28 09:00:00 +0400
commiteedc36cb12f20ed62f5dfeaea25c84c7c984cf5f (patch)
tree5171ebc934d3017789e207a6ce10f9627acc5b8c /winsup/utils/parse_pe.cc
parent3c952fed3fecfe6aec09d07a5cbad293970da0a0 (diff)
Cleanup formatting on some files. Remove excessive whitespace.
Diffstat (limited to 'winsup/utils/parse_pe.cc')
-rw-r--r--winsup/utils/parse_pe.cc75
1 files changed, 39 insertions, 36 deletions
diff --git a/winsup/utils/parse_pe.cc b/winsup/utils/parse_pe.cc
index 00aeb5502..b43957279 100644
--- a/winsup/utils/parse_pe.cc
+++ b/winsup/utils/parse_pe.cc
@@ -4,11 +4,11 @@
Written by Egor Duda <deo@logos-m.ru>
-This file is part of Cygwin.
+ This file is part of Cygwin.
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
+ This software is a copyrighted work licensed under the terms of the
+ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+ details. */
#include <bfd.h>
#include <stdio.h>
@@ -17,22 +17,25 @@ details. */
#include "dumper.h"
int
-exclusion::add ( LPBYTE mem_base, DWORD mem_size )
+exclusion::add (LPBYTE mem_base, DWORD mem_size)
{
- while ( last >= size ) size += step;
- region = (process_mem_region*) realloc ( region, size * sizeof ( process_mem_region ) );
- if ( region == NULL ) return 0;
- region [ last ].base = mem_base;
- region [ last ].size = mem_size;
+ while (last >= size)
+ size += step;
+ region = (process_mem_region *) realloc (region, size * sizeof (process_mem_region));
+ if (region == NULL)
+ return 0;
+ region[last].base = mem_base;
+ region[last].size = mem_size;
last++;
return 1;
};
-int cmp_regions ( const void* r1, const void* r2 )
+int
+cmp_regions (const void *r1, const void *r2)
{
- if ( ((process_mem_region*) r1)->base < ((process_mem_region*) r2)->base )
+ if (((process_mem_region *) r1)->base < ((process_mem_region *) r2)->base)
return -1;
- if ( ((process_mem_region*) r1)->base > ((process_mem_region*) r2)->base )
+ if (((process_mem_region *) r1)->base > ((process_mem_region *) r2)->base)
return 1;
return 0;
}
@@ -40,49 +43,49 @@ int cmp_regions ( const void* r1, const void* r2 )
int
exclusion::sort_and_check ()
{
- qsort ( region, last, sizeof ( process_mem_region ), &cmp_regions );
- for ( process_mem_region* p = region; p < region + last - 1; p++ )
+ qsort (region, last, sizeof (process_mem_region), &cmp_regions);
+ for (process_mem_region * p = region; p < region + last - 1; p++)
{
- process_mem_region* q = p + 1;
- if ( p->base + size > q->base )
- {
- fprintf ( stderr, "region error @ %08x", p->base );
- return 0;
- }
+ process_mem_region *q = p + 1;
+ if (p->base + size > q->base)
+ {
+ fprintf (stderr, "region error @ %08x", p->base);
+ return 0;
+ }
}
return 1;
}
static void
-select_data_section ( bfd *abfd, asection *sect, PTR obj )
+select_data_section (bfd * abfd, asection * sect, PTR obj)
{
- exclusion* excl_list = (exclusion*) obj;
+ exclusion *excl_list = (exclusion *) obj;
- if ( ( sect->flags & ( SEC_CODE | SEC_DEBUGGING ) ) &&
- sect->vma && sect->_raw_size )
+ if ((sect->flags & (SEC_CODE | SEC_DEBUGGING)) &&
+ sect->vma && sect->_raw_size)
{
- excl_list->add ( (LPBYTE)sect->vma, (DWORD)sect->_raw_size );
- deb_printf ( "excluding section: %20s %08lx\n", sect->name, sect->_raw_size);
+ excl_list->add ((LPBYTE) sect->vma, (DWORD) sect->_raw_size);
+ deb_printf ("excluding section: %20s %08lx\n", sect->name, sect->_raw_size);
}
}
int
-parse_pe ( const char* file_name, exclusion* excl_list )
+parse_pe (const char *file_name, exclusion * excl_list)
{
- if ( file_name == NULL || excl_list == NULL ) return 0;
+ if (file_name == NULL || excl_list == NULL)
+ return 0;
- bfd* abfd = bfd_openr ( file_name, "pei-i386" );
- if ( abfd == NULL )
+ bfd *abfd = bfd_openr (file_name, "pei-i386");
+ if (abfd == NULL)
{
- bfd_perror ( "failed to open file" );
+ bfd_perror ("failed to open file");
return 0;
}
- bfd_check_format ( abfd, bfd_object );
- bfd_map_over_sections ( abfd, &select_data_section, (PTR)excl_list );
+ bfd_check_format (abfd, bfd_object);
+ bfd_map_over_sections (abfd, &select_data_section, (PTR) excl_list);
excl_list->sort_and_check ();
- bfd_close ( abfd );
+ bfd_close (abfd);
return 1;
}
-