]> sigrok.org Git - libsigrok.git/blobdiff - hardware/common/dmm/es519xx.c
Centralise duplicated logging helper defines.
[libsigrok.git] / hardware / common / dmm / es519xx.c
index 0a0a2231e64723c83f657a55794676559d06af58..999422955095ad4d84857c8df75879fca542694e 100644 (file)
 #include "libsigrok.h"
 #include "libsigrok-internal.h"
 
-/* Message logging helpers with subsystem-specific prefix string. */
-#define LOG_PREFIX "es519xx: "
-#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
-#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args)
-#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args)
-#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args)
-#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args)
-#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args)
+#define LOG_PREFIX "es519xx"
 
 /* Factors for the respective measurement mode (0 means "invalid"). */
 static const float factors_2400_11b[8][8] = {
@@ -606,7 +599,7 @@ static int sr_es519xx_parse(const uint8_t *buf, float *floatval,
  */
 SR_PRIV gboolean sr_es519xx_2400_11b_packet_valid(const uint8_t *buf)
 {
-       struct es519xx_info info;
+       struct es519xx_info info = { 0 };
 
        info.baudrate = 2400;
        info.packet_size = 11;
@@ -620,6 +613,7 @@ SR_PRIV int sr_es519xx_2400_11b_parse(const uint8_t *buf, float *floatval,
        struct es519xx_info *info_local;
 
        info_local = info;
+       memset(info_local, 0, sizeof(struct es519xx_info));
        info_local->baudrate = 2400;
        info_local->packet_size = 11;
 
@@ -632,7 +626,7 @@ SR_PRIV int sr_es519xx_2400_11b_parse(const uint8_t *buf, float *floatval,
  */
 SR_PRIV gboolean sr_es519xx_2400_11b_altfn_packet_valid(const uint8_t *buf)
 {
-       struct es519xx_info info;
+       struct es519xx_info info = { 0 };
 
        info.baudrate = 2400;
        info.packet_size = 11;
@@ -647,6 +641,7 @@ SR_PRIV int sr_es519xx_2400_11b_altfn_parse(const uint8_t *buf,
        struct es519xx_info *info_local;
 
        info_local = info;
+       memset(info_local, 0, sizeof(struct es519xx_info));
        info_local->baudrate = 2400;
        info_local->packet_size = 11;
        info_local->alt_functions = TRUE;
@@ -660,7 +655,7 @@ SR_PRIV int sr_es519xx_2400_11b_altfn_parse(const uint8_t *buf,
  */
 SR_PRIV gboolean sr_es519xx_19200_11b_5digits_packet_valid(const uint8_t *buf)
 {
-       struct es519xx_info info;
+       struct es519xx_info info = { 0 };
 
        info.baudrate = 19200;
        info.packet_size = 11;
@@ -675,6 +670,7 @@ SR_PRIV int sr_es519xx_19200_11b_5digits_parse(const uint8_t *buf,
        struct es519xx_info *info_local;
 
        info_local = info;
+       memset(info_local, 0, sizeof(struct es519xx_info));
        info_local->baudrate = 19200;
        info_local->packet_size = 11;
        info_local->fivedigits = TRUE;
@@ -688,7 +684,7 @@ SR_PRIV int sr_es519xx_19200_11b_5digits_parse(const uint8_t *buf,
  */
 SR_PRIV gboolean sr_es519xx_19200_11b_clamp_packet_valid(const uint8_t *buf)
 {
-       struct es519xx_info info;
+       struct es519xx_info info = { 0 };
 
        info.baudrate = 19200;
        info.packet_size = 11;
@@ -703,6 +699,7 @@ SR_PRIV int sr_es519xx_19200_11b_clamp_parse(const uint8_t *buf,
        struct es519xx_info *info_local;
 
        info_local = info;
+       memset(info_local, 0, sizeof(struct es519xx_info));
        info_local->baudrate = 19200;
        info_local->packet_size = 11;
        info_local->clampmeter = TRUE;
@@ -716,7 +713,7 @@ SR_PRIV int sr_es519xx_19200_11b_clamp_parse(const uint8_t *buf,
  */
 SR_PRIV gboolean sr_es519xx_19200_11b_packet_valid(const uint8_t *buf)
 {
-       struct es519xx_info info;
+       struct es519xx_info info = { 0 };
 
        info.baudrate = 19200;
        info.packet_size = 11;
@@ -730,6 +727,7 @@ SR_PRIV int sr_es519xx_19200_11b_parse(const uint8_t *buf, float *floatval,
        struct es519xx_info *info_local;
 
        info_local = info;
+       memset(info_local, 0, sizeof(struct es519xx_info));
        info_local->baudrate = 19200;
        info_local->packet_size = 11;
 
@@ -742,7 +740,7 @@ SR_PRIV int sr_es519xx_19200_11b_parse(const uint8_t *buf, float *floatval,
  */
 SR_PRIV gboolean sr_es519xx_19200_14b_packet_valid(const uint8_t *buf)
 {
-       struct es519xx_info info;
+       struct es519xx_info info = { 0 };
 
        info.baudrate = 19200;
        info.packet_size = 14;
@@ -756,6 +754,7 @@ SR_PRIV int sr_es519xx_19200_14b_parse(const uint8_t *buf, float *floatval,
        struct es519xx_info *info_local;
 
        info_local = info;
+       memset(info_local, 0, sizeof(struct es519xx_info));
        info_local->baudrate = 19200;
        info_local->packet_size = 14;
 
@@ -768,7 +767,7 @@ SR_PRIV int sr_es519xx_19200_14b_parse(const uint8_t *buf, float *floatval,
  */
 SR_PRIV gboolean sr_es519xx_19200_14b_sel_lpf_packet_valid(const uint8_t *buf)
 {
-       struct es519xx_info info;
+       struct es519xx_info info = { 0 };
 
        info.baudrate = 19200;
        info.packet_size = 14;
@@ -783,6 +782,7 @@ SR_PRIV int sr_es519xx_19200_14b_sel_lpf_parse(const uint8_t *buf,
        struct es519xx_info *info_local;
 
        info_local = info;
+       memset(info_local, 0, sizeof(struct es519xx_info));
        info_local->baudrate = 19200;
        info_local->packet_size = 14;
        info_local->selectable_lpf = TRUE;