Rev 3912 | Rev 4743 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3912 | Rev 4307 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | #ifndef __NET_ERR_H__ |
37 | #ifndef __NET_ERR_H__ |
38 | #define __NET_ERR_H__ |
38 | #define __NET_ERR_H__ |
39 | 39 | ||
40 | #include <errno.h> |
40 | #include <errno.h> |
41 | 41 | ||
- | 42 | #ifdef CONFIG_DEBUG |
|
- | 43 | ||
- | 44 | #include <stdio.h> |
|
- | 45 | ||
- | 46 | #endif |
|
- | 47 | ||
42 | /** An actual stored error code. |
48 | /** An actual stored error code. |
43 | */ |
49 | */ |
44 | #define ERROR_CODE error_check_return_value |
50 | #define ERROR_CODE error_check_return_value |
45 | 51 | ||
46 | /** An error processing routines declaration. |
52 | /** An error processing routines declaration. |
Line 56... | Line 62... | ||
56 | #define ERROR_OCCURRED( value ) (( ERROR_CODE = ( value )) != EOK ) |
62 | #define ERROR_OCCURRED( value ) (( ERROR_CODE = ( value )) != EOK ) |
57 | 63 | ||
58 | /** Checks if an error occurred and immediately exits the actual function returning the error code. |
64 | /** Checks if an error occurred and immediately exits the actual function returning the error code. |
59 | * @param value The value to be checked. May be a function call. Input parameter. |
65 | * @param value The value to be checked. May be a function call. Input parameter. |
60 | */ |
66 | */ |
- | 67 | #ifdef CONFIG_DEBUG |
|
- | 68 | ||
- | 69 | #define ERROR_PROPAGATE( value ) if( ERROR_OCCURRED( value )){ printf( "error at %s:%d %d\n", __FILE__, __LINE__, ERROR_CODE ); return ERROR_CODE; } |
|
- | 70 | ||
- | 71 | #else |
|
- | 72 | ||
61 | #define ERROR_PROPAGATE( value ) if( ERROR_OCCURRED( value )) return ERROR_CODE |
73 | #define ERROR_PROPAGATE( value ) if( ERROR_OCCURRED( value )) return ERROR_CODE |
62 | 74 | ||
63 | #endif |
75 | #endif |
64 | 76 | ||
- | 77 | #endif |
|
- | 78 | ||
65 | /** @} |
79 | /** @} |
66 | */ |
80 | */ |