Reduce scope to avoid cppcheck warning.
This patch reduces the scope of the str variable to avoid a cppcheck warning. It also sets the end pointer to NULL since it is not used/needed.
This commit is contained in:
parent
69c5d6f5ce
commit
3e9f831026
|
|
@ -1,5 +1,5 @@
|
|||
/* vi:sw=6
|
||||
* 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
|
||||
|
|
@ -16,9 +16,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: getlongp.c,v 1.3 2003/03/15 05:42:39 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -34,7 +31,6 @@ int tf_getlongp(int *highvalue, int n)
|
|||
vpiHandle sys_h, sys_i, arg_h = 0;
|
||||
s_vpi_value value;
|
||||
int len, rtn;
|
||||
char *str, **end = 0;
|
||||
|
||||
assert(highvalue);
|
||||
assert(n > 0);
|
||||
|
|
@ -56,31 +52,19 @@ int tf_getlongp(int *highvalue, int n)
|
|||
/* convert string to int(s) */
|
||||
len = strlen(value.value.str);
|
||||
if (len > 8) {
|
||||
char *str;
|
||||
/* low word */
|
||||
str = value.value.str + (len - 8);
|
||||
rtn = (int) strtoul(str, end, 16);
|
||||
rtn = (int) strtoul(str, 0, 16);
|
||||
/* high word */
|
||||
*str = '\0';
|
||||
*highvalue = (int) strtoul(value.value.str, end, 16);
|
||||
*highvalue = (int) strtoul(value.value.str, 0, 16);
|
||||
} else {
|
||||
*highvalue = 0;
|
||||
rtn = (int) strtoul(value.value.str, end, 16);
|
||||
rtn = (int) strtoul(value.value.str, 0, 16);
|
||||
}
|
||||
|
||||
vpi_free_object(sys_i);
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: getlongp.c,v $
|
||||
* Revision 1.3 2003/03/15 05:42:39 steve
|
||||
* free argument iterators.
|
||||
*
|
||||
* Revision 1.2 2002/08/12 01:35:02 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
* Revision 1.1 2002/06/07 02:58:59 steve
|
||||
* Add a bunch of acc/tf functions. (mruff)
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue