[svn-commits] trunk r346 - /trunk/q931.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Jun 2 07:34:20 MST 2006


Author: mattf
Date: Fri Jun  2 09:34:20 2006
New Revision: 346

URL: http://svn.digium.com/view/libpri?rev=346&view=rev
Log:
Fix for 7115.  Don't call pri_message multiple times

Modified:
    trunk/q931.c

Modified: trunk/q931.c
URL: http://svn.digium.com/view/libpri/trunk/q931.c?rev=346&r1=345&r2=346&view=diff
==============================================================================
--- trunk/q931.c (original)
+++ trunk/q931.c Fri Jun  2 09:34:20 2006
@@ -2119,15 +2119,17 @@
 	unsigned int x;
 	int full_ie = Q931_FULL_IE(codeset, ie->ie);
 	int base_ie;
-
-	pri_message(pri, "%c [", prefix);
-	pri_message(pri, "%02x", ie->ie);
+	char *buf = malloc(ielen(ie) * 3 + 1);
+	int buflen = 0;
+
+	buf[0] = '\0';
 	if (!(ie->ie & 0x80)) {
-		pri_message(pri, " %02x", ielen(ie)-2);
+		buflen += sprintf(buf, " %02x", ielen(ie)-2);
 		for (x = 0; x + 2 < ielen(ie); ++x)
-			pri_message(pri, " %02x", ie->data[x]);
-	}
-	pri_message(pri, "]\n");
+			buflen += sprintf(buf + buflen, " %02x", ie->data[x]);
+	}
+	pri_message(pri, "%c [%02x%s]\n", prefix, ie->ie, buf);
+	free(buf);
 
 	/* Special treatment for shifts */
 	if((full_ie & 0xf0) == Q931_LOCKING_SHIFT)



More information about the svn-commits mailing list