Remove some cppcheck reduce scope warnings.

This commit is contained in:
Cary R 2012-08-31 12:11:06 -07:00
parent 882d059c1d
commit 1a82287f1e
4 changed files with 9 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003 Michael Ruff (mruff at chiaro.com)
* Copyright (c) 2003-2012 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -28,12 +28,11 @@
*/
handle acc_handle_by_name(const char*obj_name, handle scope)
{
vpiHandle sys_h;
vpiHandle res;
/* if no scope provided, use tasks scope */
if (!scope) {
sys_h = vpi_handle(vpiSysTfCall, 0 /* NULL */);
vpiHandle sys_h = vpi_handle(vpiSysTfCall, 0 /* NULL */);
scope = vpi_handle(vpiScope, sys_h);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
* Copyright (c) 2002-2012 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -25,9 +25,11 @@
*/
handle acc_handle_tfarg(int n)
{
vpiHandle sys_h, sys_i, rtn_h = 0;
vpiHandle rtn_h = 0;
if (n > 0) {
vpiHandle sys_h, sys_i;
sys_h = vpi_handle(vpiSysTfCall, 0 /* NULL */);
sys_i = vpi_iterate(vpiArgument, sys_h);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2011 Michael Ruff (mruff at chiaro.com)
* Copyright (c) 2002-2012 Michael Ruff (mruff at chiaro.com)
* Michael Runyan (mrunyan at chiaro.com)
*
* This source code is free software; you can redistribute it
@ -184,7 +184,6 @@ static PLI_INT32 compiletf(char *data)
p_tfcell tf;
s_cb_data cb_data;
vpiHandle call_h, arg_i, arg_h;
p_pli_data dp;
int rtn = 0;
/* cast back from opaque */
@ -221,7 +220,7 @@ static PLI_INT32 compiletf(char *data)
cb_data.reason = cbValueChange;
while ((arg_h = vpi_scan(arg_i)) != NULL) {
/* replicate user_data for each instance */
dp = calloc(1, sizeof(s_pli_data));
p_pli_data dp = calloc(1, sizeof(s_pli_data));
memcpy(dp, cb_data.user_data, sizeof(s_pli_data));
dp->paramvc = paramvc++;
cb_data.user_data = (char *)dp;

View File

@ -252,7 +252,6 @@ static PLI_INT32 sys_fflush_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
vpiHandle arg;
s_vpi_value val;
PLI_UINT32 fd_mcd;
FILE *fp;
errno = 0;
/* If we have no argument then flush all the streams. */
@ -286,7 +285,7 @@ static PLI_INT32 sys_fflush_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
vpi_mcd_flush(fd_mcd);
} else {
/* If we have a valid file descriptor flush the file. */
fp = vpi_get_file(fd_mcd);
FILE *fp = vpi_get_file(fd_mcd);
if (fp) fflush(fp);
}