[SR-Dev] git:janakj/mysql: - small optimization in db_mysql

Jan Janak jan at iptel.org
Mon Feb 16 22:07:52 CET 2009


Module: sip-router
Branch: janakj/mysql
Commit: c4944cf6c149d90cd125899535b722e50364418d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c4944cf6c149d90cd125899535b722e50364418d

Author: Henning Westerholt <henning.westerholt at 1und1.de>
Committer: Henning Westerholt <henning.westerholt at 1und1.de>
Date:   Tue Feb 26 14:41:46 2008 +0000

- small optimization in db_mysql


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3761 689a6050-402a-0410-94f2-e92a70836424

---

 modules/db_mysql/km_val.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/db_mysql/km_val.c b/modules/db_mysql/km_val.c
index 55fc220..9c626d7 100644
--- a/modules/db_mysql/km_val.c
+++ b/modules/db_mysql/km_val.c
@@ -194,14 +194,13 @@ int db_mysql_val2str(const db_con_t* _c, const db_val_t* _v, char* _s, int* _len
 		break;
 
 	case DB_STR:
-		l = VAL_STR(_v).len;
-		if (*_len < (l * 2 + 3)) {
+		if (*_len < (VAL_STR(_v).len * 2 + 3)) {
 			LM_ERR("destination buffer too short\n");
 			return -6;
 		} else {
 			old_s = _s;
 			*_s++ = '\'';
-			_s += mysql_real_escape_string(CON_CONNECTION(_c), _s, VAL_STR(_v).s, l);
+			_s += mysql_real_escape_string(CON_CONNECTION(_c), _s, VAL_STR(_v).s, VAL_STR(_v).len);
 			*_s++ = '\'';
 			*_s = '\0';
 			*_len = _s - old_s;




More information about the sr-dev mailing list