cvs: php4 /ext/mssql php_mssql.c

From: Date: Wed, 09 May 2001 16:20:36 +0000
Subject: cvs: php4 /ext/mssql php_mssql.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5628@lists.php.net to get a copy of this message
fmk Wed May 9 09:20:36 2001 EDT Modified files: /php4/ext/mssql php_mssql.c Log: Getting rid of memset. Index: php4/ext/mssql/php_mssql.c diff -u php4/ext/mssql/php_mssql.c:1.44 php4/ext/mssql/php_mssql.c:1.45 --- php4/ext/mssql/php_mssql.c:1.44 Tue May 8 12:24:14 2001 +++ php4/ext/mssql/php_mssql.c Wed May 9 09:20:34 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mssql.c,v 1.44 2001/05/08 19:24:14 fmk Exp $ */ +/* $Id: php_mssql.c,v 1.45 2001/05/09 16:20:34 fmk Exp $ */ #ifdef COMPILE_DL_MSSQL #define HAVE_MSSQL 1 @@ -760,13 +760,8 @@ if (column_type == SQLDATETIME) res_length += 10; res_buf = (char *) emalloc(res_length); - memset(res_buf, 0, res_length + 1); - dbconvert(NULL,column_type,dbdata(mssql_ptr->link,offset), res_length,SQLCHAR,res_buf,-1); - - while (res_length>0 && (res_buf[res_length-1] == ' ' || res_buf[res_length-1] == 0)) { /* nuke trailing whitespace */ - res_length--; - } - res_buf[res_length] = 0; + res_length = dbconvert(NULL,column_type,dbdata(mssql_ptr->link,offset), res_length,SQLCHAR,res_buf,-1); + result->value.str.val = res_buf; result->value.str.len = res_length; result->type = IS_STRING; @@ -805,15 +800,10 @@ int res_length = dbdatlen(mssql_ptr->link,offset) + 1; if (column_type == SQLDATETIM4) res_length += 14; if (column_type == SQLDATETIME) res_length += 10; - - res_buf = (unsigned char *) emalloc(res_length+1); - memset(res_buf, 0, res_length + 1); - dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1); - while (res_length>0 && (res_buf[res_length-1] == ' ' || res_buf[res_length-1] == 0)) { /* nuke trailing whitespace */ - res_length--; - } - res_buf[res_length] = 0; + res_buf = (unsigned char *) emalloc(res_length); + res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1); + result->value.str.val = res_buf; result->value.str.len = res_length; result->type = IS_STRING;

« previous php.cvs (#5628) next »