From: Guillaume Zajac Date: Mon, 25 Mar 2013 14:14:16 +0000 (+0100) Subject: Fix Macro issue X-Git-Tag: 2.1b_release~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2de60755f8762a2b1d7f544268e8f9417bbce9e1;p=framework%2Ftelephony%2Flibtcore.git Fix Macro issue --- diff --git a/include/log.h b/include/log.h index 3be554b..7d57aef 100644 --- a/include/log.h +++ b/include/log.h @@ -31,11 +31,11 @@ __BEGIN_DECLS #define TCORE_LOG_TAG "UNKNOWN" #endif -#define info(fmt,args...) { RLOG(LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); } -#define msg(fmt,args...) { RLOG(LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); } -#define dbg(fmt,args...) { RLOG(LOG_DEBUG, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } -#define warn(fmt,args...) { RLOG(LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } -#define err(fmt,args...) { RLOG(LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } +#define info(fmt,args...) do { RLOG(LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); } while(0) +#define msg(fmt,args...) do { RLOG(LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); } while(0) +#define dbg(fmt,args...) do { RLOG(LOG_DEBUG, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0) +#define warn(fmt,args...) do { RLOG(LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0) +#define err(fmt,args...) do { RLOG(LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0) #elif defined(FEATURE_TLOG_DEBUG) @@ -67,11 +67,11 @@ enum tcore_log_priority { */ void tcore_log(enum tcore_log_type type, enum tcore_log_priority priority, const char *tag, const char *fmt, ...); -#define info(fmt,args...) { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); } -#define msg(fmt,args...) { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); } -#define dbg(fmt,args...) { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } -#define warn(fmt,args...) { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } -#define err(fmt,args...) { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } +#define info(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); } while(0) +#define msg(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); } while(0) +#define dbg(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0) +#define warn(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0) +#define err(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0) #else @@ -103,11 +103,11 @@ void tcore_log(enum tcore_log_type type, enum tcore_log_priority priority, const #define TCORE_LOG_FUNC fprintf #endif -#define info(fmt,args...) TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE); -#define msg(fmt,args...) TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE); -#define dbg(fmt,args...) TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTGRAY "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); -#define warn(fmt,args...) TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_YELLOW "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); -#define err(fmt,args...) TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTRED "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); +#define info(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE); } while(0) +#define msg(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE); } while(0) +#define dbg(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTGRAY "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0) +#define warn(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_YELLOW "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0) +#define err(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTRED "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0) #endif diff --git a/src/co_sat.c b/src/co_sat.c index 6deef7a..35d4048 100644 --- a/src/co_sat.c +++ b/src/co_sat.c @@ -809,7 +809,7 @@ static enum tcore_sat_result _sat_decode_device_identities_tlv(unsigned char* tl break; default:{ if (tlv_str[index] >= 0x21 && tlv_str[index] <= 0x27) { - dbg("BIP channel id(0x%x)", tlv_str[index]) + dbg("BIP channel id(0x%x)", tlv_str[index]); if (i == 0) dev_id_obj->src = tlv_str[index]; if (i == 1) dev_id_obj->dest = tlv_str[index]; } @@ -5199,7 +5199,7 @@ static int _sat_encode_command_detail_tlv(const struct tel_sat_cmd_detail_info* dst[current_index] += 0x80; }break; case SAT_PROATV_CMD_MORE_TIME:{ - dbg("more time : 1bit RFU") + dbg("more time : 1bit RFU"); }break; case SAT_PROATV_CMD_PLAY_TONE:{ //command detail vibration alert @@ -5246,7 +5246,7 @@ static int _sat_encode_command_detail_tlv(const struct tel_sat_cmd_detail_info* dst[current_index] += src->cmd_qualifier.setup_call.setup_call; }break; case SAT_PROATV_CMD_SETUP_EVENT_LIST:{ - dbg("setup evnet list : 1bit RFU") + dbg("setup evnet list : 1bit RFU"); }break; case SAT_PROATV_CMD_OPEN_CHANNEL:{ if (src->cmd_qualifier.open_channel.immediate_link) diff --git a/src/mux.c b/src/mux.c index b803299..59d3c29 100644 --- a/src/mux.c +++ b/src/mux.c @@ -254,7 +254,7 @@ static unsigned char _cmux_calc_crc(unsigned char *header, int length) /* Ones complement */ crc = (0xFF - fcs); - dbg("Exit - CRC: [0x%02x]", crc) + dbg("Exit - CRC: [0x%02x]", crc); return crc; } diff --git a/src/server.c b/src/server.c index 6c38233..d23dce2 100644 --- a/src/server.c +++ b/src/server.c @@ -141,7 +141,7 @@ static TcoreModem *_server_find_modem(Server *s, */ if ((modem_iface_plugin == modem->modem_iface_plugin) && ((modem_plugin == NULL) && (modem->modem_plugin == NULL))) { - dbg("'modem' found!!!") + dbg("'modem' found!!!"); return modem; } @@ -154,7 +154,7 @@ static TcoreModem *_server_find_modem(Server *s, */ if ((modem_iface_plugin == NULL) && (modem_plugin == modem->modem_plugin)) { - dbg("'modem' found!!!") + dbg("'modem' found!!!"); return modem; } @@ -168,7 +168,7 @@ static TcoreModem *_server_find_modem(Server *s, if ((modem_iface_plugin == modem_plugin) && ((modem_iface_plugin == modem->modem_iface_plugin) || (modem_plugin == modem->modem_plugin))) { - dbg("'modem' found!!!") + dbg("'modem' found!!!"); return modem; } }