Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/socket/include/net_err.h

    r2721a75 r849ed54  
    2828
    2929/** @addtogroup net
    30  * @{
     30 *  @{
    3131 */
    3232
    3333/** @file
    34  * Common error processing codes and routines.
     34 *  Common error processing codes and routines.
    3535 */
    3636
     
    4141
    4242#ifdef CONFIG_DEBUG
    43         #include <stdio.h>
    44         #include <str_error.h>
     43
     44#include <stdio.h>
     45
    4546#endif
    4647
    4748/** An actual stored error code.
    48  *
    4949 */
    50 #define ERROR_CODE  error_check_return_value
     50#define ERROR_CODE                                      error_check_return_value
    5151
    5252/** An error processing routines declaration.
    53  *
    54  * This has to be declared in the block where the error processing
    55  * is desired.
    56  *
     53 *  This has to be declared in the block where the error processing is desired.
    5754 */
    58 #define ERROR_DECLARE  int ERROR_CODE
     55#define ERROR_DECLARE                           int ERROR_CODE
    5956
    60 /** Store the value as an error code and checks if an error occurred.
    61  *
    62  * @param[in] value The value to be checked. May be a function call.
    63  * @return False if the value indicates success (EOK).
    64  * @return True otherwise.
    65  *
     57/** Stores the value as an error code and checks if an error occurred.
     58 *  @param[in] value The value to be checked. May be a function call.
     59 *  @returns FALSE if the value indicates success (EOK).
     60 *  @returns TRUE otherwise.
    6661 */
    6762#ifdef CONFIG_DEBUG
    6863
    69 #define ERROR_OCCURRED(value) \
    70         (((ERROR_CODE = (value)) != EOK) \
    71         && ({ \
    72                 fprintf(stderr, "libsocket error at %s:%d (%s)\n", \
    73                 __FILE__, __LINE__, str_error(ERROR_CODE)); \
    74                 1; \
    75         }))
     64#define ERROR_OCCURRED(value)                                                                                           \
     65        (((ERROR_CODE = (value)) != EOK)                                                                                \
     66        && ({printf("error at %s:%d %d\n", __FILE__, __LINE__, ERROR_CODE); 1;}))
    7667
    7768#else
    7869
    79 #define ERROR_OCCURRED(value)  ((ERROR_CODE = (value)) != EOK)
     70#define ERROR_OCCURRED(value)           ((ERROR_CODE = (value)) != EOK)
    8071
    8172#endif
    8273
    83 /** Error propagation
    84  *
    85  * Check if an error occurred and immediately exit the actual
    86  * function returning the error code.
    87  *
    88  * @param[in] value The value to be checked. May be a function call.
    89  *
     74/** Checks if an error occurred and immediately exits the actual function returning the error code.
     75 *  @param[in] value The value to be checked. May be a function call.
    9076 */
    9177
    92 #define ERROR_PROPAGATE(value) \
    93         if (ERROR_OCCURRED(value)) \
    94                 return ERROR_CODE
     78#define ERROR_PROPAGATE(value)  if(ERROR_OCCURRED(value)) return ERROR_CODE
    9579
    9680#endif
Note: See TracChangeset for help on using the changeset viewer.