Changeset 5150:3c2925abe3ed in roaraudio


Ignore:
Timestamp:
10/15/11 15:35:46 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added code to save error state, marked roar_err_is_errno_clean() as obsolete

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/error.c

    r5147 r5150  
    225225 if ( *err != ROAR_ERROR_NONE ) { 
    226226  roar_err_to_errno(); 
    227  } else if ( !roar_err_is_errno_clean() ) { 
     227 } else if ( !roar_err_is_errno_clear() ) { 
    228228  roar_err_from_errno(); 
    229229 } 
     
    231231 
    232232int    roar_err_is_errno_clean(void) { 
     233 roar_debug_warn_obsolete("roar_err_is_errno_clean", "roar_err_is_errno_clear", NULL); 
     234 return roar_err_is_errno_clear(); 
     235} 
     236 
     237int    roar_err_is_errno_clear(void) { 
    233238 return errno == CLEAN_ERRNO ? 1 : 0; 
    234239} 
     
    877882 } 
    878883} 
     884 
     885 
     886// store a error state (both libroar and system) 
     887int    roar_err_store(struct roar_error_state * state) { 
     888 if ( state == NULL ) 
     889  return ROAR_ERROR_FAULT; 
     890 
     891 memset(state, 0, sizeof(struct roar_error_state)); 
     892 
     893 state->refc          = 0; 
     894 state->libroar_error = roar_error; 
     895 state->system_errno  = errno; 
     896 
     897 return ROAR_ERROR_NONE; 
     898} 
     899 
     900// restore error state to values at time of call to roar_err_store() 
     901int    roar_err_restore(struct roar_error_state * state) { 
     902 if ( state == NULL ) 
     903  return ROAR_ERROR_FAULT; 
     904 
     905 roar_err_set(state->libroar_error); 
     906 errno = state->system_errno; 
     907 
     908 return ROAR_ERROR_NONE; 
     909} 
     910 
    879911 
    880912// phi@ph7:roaraudio $ grep '^#define ROAR_ERROR_' error.h  | tr -d /\* | while read d c d t; do printf "  {%-23s \"%s\"},\n" $c, "$t"; done 
Note: See TracChangeset for help on using the changeset viewer.