From 4f48a490f9af51f22946af72d908777af1c1f148 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 20 Jun 2014 14:24:18 +0000 Subject: indent --- trace.c | 92 ++++++++++++++++++++++++++++------------------------------------- 1 file changed, 39 insertions(+), 53 deletions(-) (limited to 'trace.c') diff --git a/trace.c b/trace.c index d5975a4..31d01f7 100644 --- a/trace.c +++ b/trace.c @@ -15,58 +15,44 @@ #include "symbols.h" #include "stack.h" - -int main( int argc, char *argv[] ) +int +main(int argc, char *argv[]) { - FILE *tracef; - char type; - unsigned int address; - - if (argc != 2) { - - printf("Usage: pvtrace \n\n"); - exit(-1); - - } - - initSymbol( argv[1] ); - stackInit(); - - tracef = fopen("trace.txt", "r"); - - if (tracef == NULL) { - printf("Can't open trace.txt\n"); - exit(-1); - } - - while (!feof(tracef)) { - - fscanf( tracef, "%c0x%x\n", &type, &address ); - - if (type == 'E') { - - /* Function Entry */ - - addSymbol( address ); - - addCallTrace( address ); - - stackPush( address ); - - } else if (type == 'X') { - - /* Function Exit */ - - (void) stackPop(); - - } - - } - - emitSymbols(); - - fclose( tracef ); - - return 0; + FILE *tracef; + char type; + unsigned int address; + + if (argc != 2) { + printf("Usage: pvtrace \n\n"); + exit(-1); + } + initSymbol(argv[1]); + stackInit(); + + tracef = fopen("trace.txt", "r"); + + if (tracef == NULL) { + printf("Can't open trace.txt\n"); + exit(-1); + } + while (!feof(tracef)) { + fscanf(tracef, "%c0x%x\n", &type, &address); + switch (type) { + case 'E': + /* Function Entry */ + addSymbol(address); + addCallTrace(address); + stackPush(address); + break; + case 'X': + /* Function Exit */ + (void) stackPop(); + break; + } + } + + emitSymbols(); + fclose(tracef); + + return 0; } - -- cgit v1.2.3