From e0d71f7a5668bca64ff72e9621bc95bd9b50bfa6 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 17 Aug 2009 13:31:20 +0000 Subject: [PATCH] 2009-08-17 Joel Sherrill * rtems/src/clockget.c: Restructure to ease coverage analysis of deprecated routine. --- cpukit/ChangeLog | 5 +++++ cpukit/rtems/src/clockget.c | 44 +++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 89bb955b36..a249f925c0 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2009-08-17 Joel Sherrill + + * rtems/src/clockget.c: Restructure to ease coverage analysis of + deprecated routine. + 2009-08-16 Joel Sherrill * libi2c/libi2c.c: Fix warnings. diff --git a/cpukit/rtems/src/clockget.c b/cpukit/rtems/src/clockget.c index 0009d47fb3..bebc100fd6 100644 --- a/cpukit/rtems/src/clockget.c +++ b/cpukit/rtems/src/clockget.c @@ -1,7 +1,7 @@ /* * Clock Manager * - * COPYRIGHT (c) 1989-2008. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -23,8 +23,7 @@ #include #include -/*PAGE - * +/* * rtems_clock_get * * This directive returns the current date and time. If the time has @@ -49,32 +48,29 @@ rtems_status_code rtems_clock_get( if ( !time_buffer ) return RTEMS_INVALID_ADDRESS; - switch ( option ) { - case RTEMS_CLOCK_GET_TOD: - return rtems_clock_get_tod( (rtems_time_of_day *)time_buffer ); + if ( option == RTEMS_CLOCK_GET_TOD ) + return rtems_clock_get_tod( (rtems_time_of_day *)time_buffer ); - case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH: + if ( option == RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH ) return rtems_clock_get_seconds_since_epoch((rtems_interval *)time_buffer); - case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT: { - rtems_interval *interval = (rtems_interval *)time_buffer; - - *interval = rtems_clock_get_ticks_since_boot(); - return RTEMS_SUCCESSFUL; - } - case RTEMS_CLOCK_GET_TICKS_PER_SECOND: { - rtems_interval *interval = (rtems_interval *)time_buffer; - - *interval = rtems_clock_get_ticks_per_second(); - return RTEMS_SUCCESSFUL; - } - case RTEMS_CLOCK_GET_TIME_VALUE: - return rtems_clock_get_tod_timeval( (struct timeval *)time_buffer ); - - default: - break; + if ( option == RTEMS_CLOCK_GET_TICKS_SINCE_BOOT ) { + rtems_interval *interval = (rtems_interval *)time_buffer; + + *interval = rtems_clock_get_ticks_since_boot(); + return RTEMS_SUCCESSFUL; } + if ( option == RTEMS_CLOCK_GET_TICKS_PER_SECOND ) { + rtems_interval *interval = (rtems_interval *)time_buffer; + + *interval = rtems_clock_get_ticks_per_second(); + return RTEMS_SUCCESSFUL; + } + + if ( option == RTEMS_CLOCK_GET_TIME_VALUE ) + return rtems_clock_get_tod_timeval( (struct timeval *)time_buffer ); + return RTEMS_INVALID_NUMBER; }