SMPP: Introduce wrapper macro to memset all structures to zero

For some reason, libsmpp34 is too smart to zero out the entire structure
to which it is unpacking.  This introduces an ugly wrapper macro to
work around.  This needs discussion with the libsmpp34 maintainer.
diff --git a/openbsc/src/libmsc/smpp_smsc.c b/openbsc/src/libmsc/smpp_smsc.c
index fc38925..765cb51 100644
--- a/openbsc/src/libmsc/smpp_smsc.c
+++ b/openbsc/src/libmsc/smpp_smsc.c
@@ -41,6 +41,11 @@
 
 #include <openbsc/debug.h>
 
+/*! \brief Ugly wrapper. libsmpp34 should do this itself! */
+#define SMPP34_UNPACK(rc, type, str, data, len)		\
+	memset(str, 0, sizeof(*str));			\
+	rc = smpp34_unpack(type, str, data, len)
+
 enum emse_bind {
 	ESME_BIND_RX = 0x01,
 	ESME_BIND_TX = 0x02,
@@ -148,8 +153,8 @@
 	char buf[SMALL_BUFF];
 	int rc;
 
-	rc = smpp34_unpack(GENERIC_NACK, &nack, msgb_data(msg),
-			   msgb_length(msg));
+	SMPP34_UNPACK(rc, GENERIC_NACK, &nack, msgb_data(msg),
+			 msgb_length(msg));
 	if (rc < 0)
 		return rc;
 
@@ -166,7 +171,7 @@
 	struct bind_receiver_resp_t bind_r;
 	int rc;
 
-	rc = smpp34_unpack(BIND_RECEIVER, &bind, msgb_data(msg),
+	SMPP34_UNPACK(rc, BIND_RECEIVER, &bind, msgb_data(msg),
 			   msgb_length(msg));
 	if (rc < 0)
 		return rc;
@@ -204,7 +209,7 @@
 	struct tlv_t tlv;
 	int rc;
 
-	rc = smpp34_unpack(BIND_TRANSMITTER, &bind, msgb_data(msg),
+	SMPP34_UNPACK(rc, BIND_TRANSMITTER, &bind, msgb_data(msg),
 			   msgb_length(msg));
 	if (rc < 0) {
 		printf("error during unpack: %s\n", smpp34_strerror);
@@ -251,7 +256,7 @@
 	struct bind_transceiver_resp_t bind_r;
 	int rc;
 
-	rc = smpp34_unpack(BIND_TRANSCEIVER, &bind, msgb_data(msg),
+	SMPP34_UNPACK(rc, BIND_TRANSCEIVER, &bind, msgb_data(msg),
 			   msgb_length(msg));
 	if (rc < 0)
 		return rc;
@@ -287,7 +292,7 @@
 	struct unbind_resp_t unbind_r;
 	int rc;
 
-	rc = smpp34_unpack(UNBIND, &unbind, msgb_data(msg),
+	SMPP34_UNPACK(rc, UNBIND, &unbind, msgb_data(msg),
 			   msgb_length(msg));
 	if (rc < 0)
 		return rc;
@@ -313,7 +318,7 @@
 	struct enquire_link_resp_t enq_r;
 	int rc;
 
-	rc = smpp34_unpack(ENQUIRE_LINK, &enq, msgb_data(msg),
+	SMPP34_UNPACK(rc, ENQUIRE_LINK, &enq, msgb_data(msg),
 			   msgb_length(msg));
 	if (rc < 0)
 		return rc;
@@ -348,7 +353,8 @@
 	struct submit_sm_resp_t submit_r;
 	int rc;
 
-	rc = smpp34_unpack(SUBMIT_SM, &submit, msgb_data(msg),
+	memset(&submit, 0, sizeof(submit));
+	SMPP34_UNPACK(rc, SUBMIT_SM, &submit, msgb_data(msg),
 			   msgb_length(msg));
 	if (rc < 0)
 		return rc;