Commit fd77c7ca authored by Paolo Ciarrocchi's avatar Paolo Ciarrocchi Committed by Ingo Molnar

x86: coding style fixes to arch/x86/boot/compressed/misc.c

Fix lots of style errors and warnings.

Before:
   total: 58 errors, 9 warnings, 469 lines checked
After:
   total: 7 errors, 8 warnings, 471 lines checked

No code changed:

arch/x86/boot/compressed/misc.o:

   text	   data	    bss	    dec	    hex	filename
  10716	      8	   2152	  12876	   324c	misc.o.before
  10716	      8	   2152	  12876	   324c	misc.o.after

md5:
   2c20c903986a3c9bca44306c6646067e  misc.o.before.asm
   2c20c903986a3c9bca44306c6646067e  misc.o.after.asm
Signed-off-by: default avatarPaolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 48e6b7a0
...@@ -127,7 +127,8 @@ typedef unsigned char uch; ...@@ -127,7 +127,8 @@ typedef unsigned char uch;
typedef unsigned short ush; typedef unsigned short ush;
typedef unsigned long ulg; typedef unsigned long ulg;
#define WSIZE 0x80000000 /* Window size must be at least 32k, #define WSIZE 0x80000000 /*
* Window size must be at least 32k,
* and a power of two * and a power of two
* We don't actually have a window just * We don't actually have a window just
* a huge output buffer so I report * a huge output buffer so I report
...@@ -155,19 +156,19 @@ static unsigned outcnt; /* bytes in output buffer */ ...@@ -155,19 +156,19 @@ static unsigned outcnt; /* bytes in output buffer */
/* Diagnostic functions */ /* Diagnostic functions */
#ifdef DEBUG #ifdef DEBUG
# define Assert(cond,msg) {if(!(cond)) error(msg);} # define Assert(cond, msg) {if(!(cond)) error(msg); }
# define Trace(x) fprintf x # define Trace(x) fprintf x
# define Tracev(x) {if (verbose) fprintf x ;} # define Tracev(x) {if (verbose) fprintf x ; }
# define Tracevv(x) {if (verbose>1) fprintf x ;} # define Tracevv(x) {if (verbose > 1) fprintf x ; }
# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} # define Tracec(c, x) {if (verbose && (c)) fprintf x ; }
# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} # define Tracecv(c, x) {if (verbose > 1 && (c)) fprintf x ; }
#else #else
# define Assert(cond,msg) # define Assert(cond, msg)
# define Trace(x) # define Trace(x)
# define Tracev(x) # define Tracev(x)
# define Tracevv(x) # define Tracevv(x)
# define Tracec(c,x) # define Tracec(c, x)
# define Tracecv(c,x) # define Tracecv(c, x)
#endif #endif
static int fill_inbuf(void); static int fill_inbuf(void);
...@@ -190,7 +191,7 @@ static unsigned char *real_mode; /* Pointer to real-mode data */ ...@@ -190,7 +191,7 @@ static unsigned char *real_mode; /* Pointer to real-mode data */
extern unsigned char input_data[]; extern unsigned char input_data[];
extern int input_len; extern int input_len;
static long bytes_out = 0; static long bytes_out;
static void *malloc(int size); static void *malloc(int size);
static void free(void *where); static void free(void *where);
...@@ -229,8 +230,10 @@ static void *malloc(int size) ...@@ -229,8 +230,10 @@ static void *malloc(int size)
{ {
void *p; void *p;
if (size <0) error("Malloc error"); if (size < 0)
if (free_mem_ptr <= 0) error("Memory error"); error("Malloc error");
if (free_mem_ptr <= 0)
error("Memory error");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
...@@ -261,14 +264,14 @@ static void scroll(void) ...@@ -261,14 +264,14 @@ static void scroll(void)
{ {
int i; int i;
memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 ); memcpy(vidmem, vidmem + cols * 2, (lines - 1) * cols * 2);
for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 ) for (i = (lines - 1) * cols * 2; i < lines * cols * 2; i += 2)
vidmem[i] = ' '; vidmem[i] = ' ';
} }
static void putstr(const char *s) static void putstr(const char *s)
{ {
int x,y,pos; int x, y, pos;
char c; char c;
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
...@@ -279,18 +282,18 @@ static void putstr(const char *s) ...@@ -279,18 +282,18 @@ static void putstr(const char *s)
x = RM_SCREEN_INFO.orig_x; x = RM_SCREEN_INFO.orig_x;
y = RM_SCREEN_INFO.orig_y; y = RM_SCREEN_INFO.orig_y;
while ( ( c = *s++ ) != '\0' ) { while ((c = *s++) != '\0') {
if ( c == '\n' ) { if (c == '\n') {
x = 0; x = 0;
if ( ++y >= lines ) { if (++y >= lines) {
scroll(); scroll();
y--; y--;
} }
} else { } else {
vidmem [(x + cols * y) * 2] = c; vidmem [(x + cols * y) * 2] = c;
if ( ++x >= cols ) { if (++x >= cols) {
x = 0; x = 0;
if ( ++y >= lines ) { if (++y >= lines) {
scroll(); scroll();
y--; y--;
} }
...@@ -308,22 +311,22 @@ static void putstr(const char *s) ...@@ -308,22 +311,22 @@ static void putstr(const char *s)
outb(0xff & (pos >> 1), vidport+1); outb(0xff & (pos >> 1), vidport+1);
} }
static void* memset(void* s, int c, unsigned n) static void *memset(void *s, int c, unsigned n)
{ {
int i; int i;
char *ss = s; char *ss = s;
for (i=0;i<n;i++) ss[i] = c; for (i = 0; i < n; i++) ss[i] = c;
return s; return s;
} }
static void* memcpy(void* dest, const void* src, unsigned n) static void *memcpy(void *dest, const void *src, unsigned n)
{ {
int i; int i;
const char *s = src; const char *s = src;
char *d = dest; char *d = dest;
for (i=0;i<n;i++) d[i] = s[i]; for (i = 0; i < n; i++) d[i] = s[i];
return dest; return dest;
} }
...@@ -383,11 +386,10 @@ static void parse_elf(void *output) ...@@ -383,11 +386,10 @@ static void parse_elf(void *output)
int i; int i;
memcpy(&ehdr, output, sizeof(ehdr)); memcpy(&ehdr, output, sizeof(ehdr));
if(ehdr.e_ident[EI_MAG0] != ELFMAG0 || if (ehdr.e_ident[EI_MAG0] != ELFMAG0 ||
ehdr.e_ident[EI_MAG1] != ELFMAG1 || ehdr.e_ident[EI_MAG1] != ELFMAG1 ||
ehdr.e_ident[EI_MAG2] != ELFMAG2 || ehdr.e_ident[EI_MAG2] != ELFMAG2 ||
ehdr.e_ident[EI_MAG3] != ELFMAG3) ehdr.e_ident[EI_MAG3] != ELFMAG3) {
{
error("Kernel is not a valid ELF file"); error("Kernel is not a valid ELF file");
return; return;
} }
...@@ -400,7 +402,7 @@ static void parse_elf(void *output) ...@@ -400,7 +402,7 @@ static void parse_elf(void *output)
memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum);
for (i=0; i<ehdr.e_phnum; i++) { for (i = 0; i < ehdr.e_phnum; i++) {
phdr = &phdrs[i]; phdr = &phdrs[i];
switch (phdr->p_type) { switch (phdr->p_type) {
...@@ -409,7 +411,7 @@ static void parse_elf(void *output) ...@@ -409,7 +411,7 @@ static void parse_elf(void *output)
dest = output; dest = output;
dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR); dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR);
#else #else
dest = (void*)(phdr->p_paddr); dest = (void *)(phdr->p_paddr);
#endif #endif
memcpy(dest, memcpy(dest,
output + phdr->p_offset, output + phdr->p_offset,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment