Work on bug #48730: Enums should be used instead of multiple defines (where applicable)

This commit is contained in:
Dirk Ziegelmeier 2016-08-12 22:51:43 +02:00
parent 36b9caed23
commit 6dcb2b2415
2 changed files with 31 additions and 27 deletions

View File

@ -205,10 +205,12 @@ static u16_t dns_txid;
#define DNS_FLAG2_ERR_NAME 0x03
/* DNS protocol states */
#define DNS_STATE_UNUSED 0
#define DNS_STATE_NEW 1
#define DNS_STATE_ASKING 2
#define DNS_STATE_DONE 3
typedef enum {
DNS_STATE_UNUSED = 0,
DNS_STATE_NEW = 1,
DNS_STATE_ASKING = 2,
DNS_STATE_DONE = 3
} dns_state_enum_t;
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"

View File

@ -57,44 +57,46 @@ typedef LWIP_ERR_T err_t;
typedef s8_t err_t;
#endif /* LWIP_ERR_T*/
/* Definitions for error constants. */
/** Definitions for error constants. */
typedef enum {
/** No error, everything OK. */
#define ERR_OK 0
ERR_OK = 0,
/** Out of memory error. */
#define ERR_MEM -1
ERR_MEM = -1,
/** Buffer error. */
#define ERR_BUF -2
ERR_BUF = -2,
/** Timeout. */
#define ERR_TIMEOUT -3
ERR_TIMEOUT = -3,
/** Routing problem. */
#define ERR_RTE -4
ERR_RTE = -4,
/** Operation in progress */
#define ERR_INPROGRESS -5
ERR_INPROGRESS = -5,
/** Illegal value. */
#define ERR_VAL -6
ERR_VAL = -6,
/** Operation would block. */
#define ERR_WOULDBLOCK -7
ERR_WOULDBLOCK = -7,
/** Address in use. */
#define ERR_USE -8
ERR_USE = -8,
/** Already connecting. */
#define ERR_ALREADY -9
ERR_ALREADY = -9,
/** Conn already established.*/
#define ERR_ISCONN -10
ERR_ISCONN = -10,
/** Not connected. */
#define ERR_CONN -11
ERR_CONN = -11,
/** Low-level netif error */
#define ERR_IF -12
ERR_IF = -12,
/** Connection aborted. */
ERR_ABRT = -13,
/** Connection reset. */
ERR_RST = -14,
/** Connection closed. */
ERR_CLSD = -15,
/** Illegal argument. */
ERR_ARG = -16
} err_enum_t;
#define ERR_IS_FATAL(e) ((e) <= ERR_ABRT)
/** Connection aborted. */
#define ERR_ABRT -13
/** Connection reset. */
#define ERR_RST -14
/** Connection closed. */
#define ERR_CLSD -15
/** Illegal argument. */
#define ERR_ARG -16
/**
* @}