Add a mecanism similar to the classical errno system for reporting error
but specific to the OBITools framwork
This commit is contained in:
10
src/obierrno.c
Normal file
10
src/obierrno.c
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* obierrno.c
|
||||
*
|
||||
* Created on: 23 mai 2015
|
||||
* Author: coissac
|
||||
*/
|
||||
|
||||
|
||||
int obi_errno;
|
||||
|
36
src/obierrno.h
Normal file
36
src/obierrno.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* obierrno.h
|
||||
*
|
||||
* Created on: 23 mai 2015
|
||||
* Author: coissac
|
||||
*/
|
||||
|
||||
#ifndef OBIERRNO_H_
|
||||
#define OBIERRNO_H_
|
||||
|
||||
/**
|
||||
* @brief The declaration of the external variable `obi_errno`.
|
||||
*
|
||||
* `obi_errno` is an equivalent of `errno` for the system level error
|
||||
* but for for error generated by the C layer of the OBITools framework.
|
||||
*
|
||||
* @todo We have to look for defining this variable as thread specific.
|
||||
*/
|
||||
extern int obi_errno;
|
||||
|
||||
/**
|
||||
* @brief set the global `obi_errno` variable with
|
||||
* the specified `err` code
|
||||
*
|
||||
* This function is defined as a macro to reduce the risk
|
||||
* to increase the problem generating the error by calling
|
||||
* a new function.
|
||||
*
|
||||
* @param err the error code as an integer value
|
||||
*
|
||||
* @since May 2015
|
||||
* @author Eric Coissac (eric.coissac@metabarcoding.org)
|
||||
*/
|
||||
#define obi_set_errno(err) (obi_errno = (err))
|
||||
|
||||
#endif /* OBIERRNO_H_ */
|
Reference in New Issue
Block a user