[Asterisk-cvs] asterisk/cdr cdr_mysql.c,1.15,1.16

markster at lists.digium.com markster at lists.digium.com
Mon Sep 8 11:46:58 CDT 2003


Update of /usr/cvsroot/asterisk/cdr
In directory mongoose.digium.com:/tmp/cvs-serv30979/cdr

Modified Files:
	cdr_mysql.c 
Log Message:
BSD portability enhancements (bug #234)


Index: cdr_mysql.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr/cdr_mysql.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** cdr_mysql.c	21 Aug 2003 16:01:25 -0000	1.15
--- cdr_mysql.c	8 Sep 2003 16:48:06 -0000	1.16
***************
*** 87,107 ****
  
  	if (connected) {
! 		char *clid=NULL, *dcontext=NULL, *channel=NULL, *dstchannel=NULL, *lastapp=NULL, *lastdata=NULL, *uniqueid=NULL;
  
  		/* Maximum space needed would be if all characters needed to be escaped, plus a trailing NULL */
! 		if (clid = alloca(strlen(cdr->clid) * 2 + 1))
  			mysql_real_escape_string(&mysql, clid, cdr->clid, strlen(cdr->clid));
! 		if (dcontext = alloca(strlen(cdr->dcontext) * 2 + 1))
  			mysql_real_escape_string(&mysql, dcontext, cdr->dcontext, strlen(cdr->dcontext));
! 		if (channel = alloca(strlen(cdr->channel) * 2 + 1))
  			mysql_real_escape_string(&mysql, channel, cdr->channel, strlen(cdr->channel));
! 		if (dstchannel = alloca(strlen(cdr->dstchannel) * 2 + 1))
  			mysql_real_escape_string(&mysql, dstchannel, cdr->dstchannel, strlen(cdr->dstchannel));
! 		if (lastapp = alloca(strlen(cdr->lastapp) * 2 + 1))
  			mysql_real_escape_string(&mysql, lastapp, cdr->lastapp, strlen(cdr->lastapp));
! 		if (lastdata = alloca(strlen(cdr->lastdata) * 2 + 1))
  			mysql_real_escape_string(&mysql, lastdata, cdr->lastdata, strlen(cdr->lastdata));
  #ifdef MYSQL_LOGUNIQUEID
! 		if (uniqueid = alloca(strlen(cdr->uniqueid) * 2 + 1))
  			mysql_real_escape_string(&mysql, uniqueid, cdr->uniqueid, strlen(cdr->uniqueid));
  #endif
--- 87,110 ----
  
  	if (connected) {
! 		char *clid=NULL, *dcontext=NULL, *channel=NULL, *dstchannel=NULL, *lastapp=NULL, *lastdata=NULL;
! #ifdef MYSQL_LOGUNIQUEID
! 		char *uniqueid=NULL;
! #endif
  
  		/* Maximum space needed would be if all characters needed to be escaped, plus a trailing NULL */
! 		if ((clid = alloca(strlen(cdr->clid) * 2 + 1)) != NULL)
  			mysql_real_escape_string(&mysql, clid, cdr->clid, strlen(cdr->clid));
! 		if ((dcontext = alloca(strlen(cdr->dcontext) * 2 + 1)) != NULL)
  			mysql_real_escape_string(&mysql, dcontext, cdr->dcontext, strlen(cdr->dcontext));
! 		if ((channel = alloca(strlen(cdr->channel) * 2 + 1)) != NULL)
  			mysql_real_escape_string(&mysql, channel, cdr->channel, strlen(cdr->channel));
! 		if ((dstchannel = alloca(strlen(cdr->dstchannel) * 2 + 1)) != NULL)
  			mysql_real_escape_string(&mysql, dstchannel, cdr->dstchannel, strlen(cdr->dstchannel));
! 		if ((lastapp = alloca(strlen(cdr->lastapp) * 2 + 1)) != NULL)
  			mysql_real_escape_string(&mysql, lastapp, cdr->lastapp, strlen(cdr->lastapp));
! 		if ((lastdata = alloca(strlen(cdr->lastdata) * 2 + 1)) != NULL)
  			mysql_real_escape_string(&mysql, lastdata, cdr->lastdata, strlen(cdr->lastdata));
  #ifdef MYSQL_LOGUNIQUEID
! 		if ((uniqueid = alloca(strlen(cdr->uniqueid) * 2 + 1)) != NULL)
  			mysql_real_escape_string(&mysql, uniqueid, cdr->uniqueid, strlen(cdr->uniqueid));
  #endif
***************
*** 142,146 ****
  }
  
! int my_unload_module(void)
  { 
  	if (connected) {
--- 145,149 ----
  }
  
! static int my_unload_module(void)
  { 
  	if (connected) {
***************
*** 178,182 ****
  }
  
! int my_load_module(void)
  {
  	int res;
--- 181,185 ----
  }
  
! static int my_load_module(void)
  {
  	int res;




More information about the svn-commits mailing list