From e180154320589b544f9c21e52979b99f59c30652 Mon Sep 17 00:00:00 2001 From: louib Date: Sat, 28 Dec 2019 13:21:42 -0500 Subject: [PATCH] Update else styling. --- .clang-format | 2 +- src/nwipe.c | 27 ++++++++++----------------- src/options.c | 9 ++++++--- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.clang-format b/.clang-format index 933ee34..729656c 100644 --- a/.clang-format +++ b/.clang-format @@ -27,7 +27,7 @@ BraceWrapping: AfterStruct: true AfterUnion: true BeforeCatch: false - BeforeElse: false + BeforeElse: true IndentBraces: false BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Custom diff --git a/src/nwipe.c b/src/nwipe.c index 19fd595..77d0161 100644 --- a/src/nwipe.c +++ b/src/nwipe.c @@ -50,12 +50,12 @@ int terminate_signal; int main( int argc, char** argv ) { - int nwipe_optind; // The result of nwipe_options(). - int nwipe_enumerated; // The number of contexts that have been enumerated. - int nwipe_error = 0; // An error counter. - int nwipe_selected = 0; // The number of contexts that have been selected. - pthread_t nwipe_gui_thread = 0; // The thread ID of the GUI thread. - pthread_t nwipe_sigint_thread; // The thread ID of the sigint handler. + int nwipe_optind; // The result of nwipe_options(). + int nwipe_enumerated; // The number of contexts that have been enumerated. + int nwipe_error = 0; // An error counter. + int nwipe_selected = 0; // The number of contexts that have been selected. + pthread_t nwipe_gui_thread = 0; // The thread ID of the GUI thread. + pthread_t nwipe_sigint_thread; // The thread ID of the sigint handler. /* The entropy source file handle. */ int nwipe_entropy; @@ -197,7 +197,6 @@ int main( int argc, char** argv ) c1[i]->prng_seed.length = 0; c1[i]->prng_seed.s = 0; c1[i]->prng_state = 0; - } /* Check for initialization errors. */ @@ -253,7 +252,6 @@ int main( int argc, char** argv ) /* Copy the context. */ c2[j++] = c1[i]; } - } /* TODO: free c1 and c2 memory. */ @@ -320,7 +318,6 @@ int main( int argc, char** argv ) if( ioctl( c2[i]->device_fd, BLKBSZGET, &c2[i]->block_size ) == 0 ) { nwipe_log( NWIPE_LOG_INFO, "Device '%s' has block size %i.", c2[i]->device_name, c2[i]->block_size ); - } else { @@ -401,7 +398,6 @@ int main( int argc, char** argv ) nwipe_gui_free(); return errno; } - } /* Change the terminal mode to non-blocking input. */ @@ -539,7 +535,6 @@ int main( int argc, char** argv ) /* Exit. */ return return_status; - } void* signal_hand( void* ptr ) @@ -626,11 +621,13 @@ void* signal_hand( void* ptr ) if( c[i]->result == 0 ) { nwipe_log( NWIPE_LOG_INFO, "%s: Success", c[i]->device_name ); - } else if( c[i]->signal ) + } + else if( c[i]->signal ) { nwipe_log( NWIPE_LOG_INFO, "%s: >>> FAILURE! <<<: signal %i", c[i]->device_name, c[i]->signal ); - } else + } + else { nwipe_log( NWIPE_LOG_INFO, "%s: >>> FAILURE! <<<: code %i", c[i]->device_name, c[i]->result ); @@ -653,15 +650,11 @@ void* signal_hand( void* ptr ) return ( (void*) 0 ); break; - } - } - } return ( 0 ); - } int cleanup() diff --git a/src/options.c b/src/options.c index 2de05c4..e104131 100644 --- a/src/options.c +++ b/src/options.c @@ -284,12 +284,14 @@ int nwipe_options_parse( int argc, char** argv ) nwipe_options.exclude[idx_drive++][idx_drive_chr] = 0; idx_drive_chr = 0; idx_optarg++; - } else + } + else { if( idx_drive_chr < MAX_DRIVE_PATH_LENGTH ) { nwipe_options.exclude[idx_drive][idx_drive_chr++] = optarg[idx_optarg++]; - } else + } + else { /* This section deals with file names that exceed MAX_DRIVE_PATH_LENGTH */ nwipe_options.exclude[idx_drive][idx_drive_chr] = 0; @@ -365,7 +367,8 @@ void nwipe_options_log( void ) if( nwipe_options.autonuke ) { nwipe_log( NWIPE_LOG_NOTICE, " autonuke = %i (on)", nwipe_options.autonuke ); - } else + } + else { nwipe_log( NWIPE_LOG_NOTICE, " autonuke = %i (off)", nwipe_options.autonuke ); }