1
1

Don't instantiate variables in for loops; we don't assume C99

compilers. 

This commit was SVN r24330.
This commit is contained in:
Jeff Squyres 2011-02-01 19:23:14 +00:00
parent ddcbfa6af0
commit c8badb79df

View File

@ -1974,10 +1974,11 @@ static int
look_powerpc_device_tree_discover_cache(device_tree_cpus_t *cpus,
uint32_t ibm_phandle, unsigned int *level, hwloc_bitmap_t cpuset)
{
unsigned int i;
int ret = -1;
if ((NULL == level) || (NULL == cpuset))
return ret;
for (unsigned int i = 0; i < cpus->n; ++i) {
for (i = 0; i < cpus->n; ++i) {
if (ibm_phandle != cpus->p[i].l2_cache)
continue;
if (NULL != cpus->p[i].cpuset) {
@ -2033,6 +2034,7 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
{
device_tree_cpus_t cpus = { .n = 0, .p = NULL, .allocated = 0 };
const char ofroot[] = "/proc/device-tree/cpus";
unsigned int i;
int root_fd = topology->backend_params.sysfs.root_fd;
DIR *dt = hwloc_opendir(ofroot, root_fd);
@ -2074,8 +2076,9 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
uint32_t nthreads = cb / sizeof(threads[0]);
if (NULL != threads) {
unsigned int i;
cpuset = hwloc_bitmap_alloc();
for (unsigned int i = 0; i < nthreads; ++i) {
for (i = 0; i < nthreads; ++i) {
hwloc_bitmap_set(cpuset, ntohl(threads[i]));
}
free(threads);
@ -2111,7 +2114,7 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
}
#ifdef HWLOC_DEBUG
for (unsigned int i = 0; i < cpus.n; ++i) {
for (i = 0; i < cpus.n; ++i) {
hwloc_debug("%i: %s ibm,phandle=%08X l2_cache=%08X ",
i, cpus.p[i].name, cpus.p[i].ibm_phandle, cpus.p[i].l2_cache);
if (NULL == cpus.p[i].cpuset) {
@ -2123,7 +2126,7 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
#endif
/* Scan L2/L3/... caches */
for (unsigned int i = 0; i < cpus.n; ++i) {
for (i = 0; i < cpus.n; ++i) {
/* Skip real CPUs */
if (NULL != cpus.p[i].cpuset)
continue;
@ -2143,7 +2146,7 @@ look_powerpc_device_tree(struct hwloc_topology *topology)
}
/* Do cleanup */
for (unsigned int i = 0; i < cpus.n; ++i) {
for (i = 0; i < cpus.n; ++i) {
hwloc_bitmap_free(cpus.p[i].cpuset);
free(cpus.p[i].name);
}