[sr-dev] [kamailio/kamailio] siptrace: use xavps to pass data for the duration of transaction/dialog (#1963)

Daniel-Constantin Mierla notifications at github.com
Fri May 24 10:10:09 CEST 2019


miconda commented on this pull request.



>  
 		/* could use the dest_info we've already parsed but there's no way to pass
 		 * it to DLGCB_CREATED callback so the only thing to do is keep
 		 * it as uri, serialize in a dlg_var and parse again in DLGCB_CREATED */
 		if(corid) {
-			info->correlation_id = *corid;
+			info->correlation_id.s = (char *)(info + 1);

Arithmetics with pointers is ok, adding 1 is practically adding the size of respective structure to the initial address. In old times, arithmetic operation with pointers was known to be safe when the pointer was referring to an array element, therefore I preferred to do cast to char* for initial pointer and then add sizeof(struct), like: `(char*)info + sizeof(siptrace_info_t)`. With modern compilers gcc/clang, I expect to be all fine with `(char*)(info + 1)`, I think it is in other parts of the code anyhow.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1963#discussion_r287256590
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190524/bc35d81d/attachment.html>


More information about the sr-dev mailing list