Changeset 4871:fd43e266a063 in roaraudio for libroar/error.c


Ignore:
Timestamp:
04/26/11 10:24:47 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added some more error handling functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/error.c

    r4870 r4871  
    3636#include "libroar.h" 
    3737 
     38// 'no error' value for errno. 
     39// zero is true for GNU/Linux. 
     40// don't know about other systems. 
     41#define CLEAN_ERRNO 0 
     42 
    3843int roar_errno = ROAR_ERROR_NONE; 
    3944 
     
    109114} 
    110115 
     116void   roar_err_clear_errno(void) { 
     117 errno = CLEAN_ERRNO; 
     118} 
     119 
     120void   roar_err_clear_all(void) { 
     121 roar_err_clear(); 
     122 roar_err_clear_errno(); 
     123} 
     124 
     125void   roar_err_update(void) { 
     126 int * err = roar_errno2(); 
     127 if ( *err != ROAR_ERROR_NONE ) { 
     128  roar_err_to_errno(); 
     129 } else if ( !roar_err_is_errno_clean() ) { 
     130  roar_err_from_errno(); 
     131 } 
     132} 
     133 
     134int    roar_err_is_errno_clean(void) { 
     135 return errno == CLEAN_ERRNO ? 1 : 0; 
     136} 
     137 
    111138void   roar_err_set(const int error) { 
    112139 *roar_errno2() = error; 
     
    228255 switch (*err) { 
    229256  case ROAR_ERROR_NONE: 
    230     errno = 0; // just gussing 
     257    roar_err_clear_errno(); 
    231258   break; 
    232259#ifdef EPERM 
Note: See TracChangeset for help on using the changeset viewer.