diff options
author | Frank M. Kromann <fmk@php.net> | 2001-05-09 16:20:34 +0000 |
---|---|---|
committer | Frank M. Kromann <fmk@php.net> | 2001-05-09 16:20:34 +0000 |
commit | 90243d2cf0d883317f3f56beec74b930a96b4fb7 (patch) | |
tree | db076a68fc83c78860c0ec8bd78d3915e925155d /ext/mssql/php_mssql.c | |
parent | 3d430e4141c4cfb4d4d2368b4ff6eafd0a182c96 (diff) | |
download | php-git-90243d2cf0d883317f3f56beec74b930a96b4fb7.tar.gz |
Getting rid of memset.
Diffstat (limited to 'ext/mssql/php_mssql.c')
-rw-r--r-- | ext/mssql/php_mssql.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index bf5c77e555..e8c90d7efb 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -760,13 +760,8 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off 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; @@ -806,14 +801,9 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int 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; |