Ver código fonte

- small optimization in db_mysql

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3761 689a6050-402a-0410-94f2-e92a70836424
Henning Westerholt 17 anos atrás
pai
commit
c4944cf6c1
1 arquivos alterados com 2 adições e 3 exclusões
  1. 2 3
      modules/db_mysql/km_val.c

+ 2 - 3
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;