Avoid various shadowed variables. libthr is now almost WARNS=4 clean except

for some const dequalifiers that needs more careful investigation.

Ok'ed by:	davidxu
This commit is contained in:
delphij 2008-04-23 21:06:51 +00:00
parent 792d568d6d
commit 6b7d752076
4 changed files with 25 additions and 25 deletions

View File

@ -39,7 +39,7 @@ __weak_reference(_pthread_getaffinity_np, pthread_getaffinity_np);
__weak_reference(_pthread_setaffinity_np, pthread_setaffinity_np);
int
_pthread_setaffinity_np(pthread_t td, size_t cpusetsize, const cpuset_t *cpuset)
_pthread_setaffinity_np(pthread_t td, size_t cpusetsize, const cpuset_t *cpusetp)
{
struct pthread *curthread = _get_curthread();
lwpid_t tid;
@ -47,7 +47,7 @@ _pthread_setaffinity_np(pthread_t td, size_t cpusetsize, const cpuset_t *cpuset)
if (td == curthread) {
error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID,
-1, cpusetsize, cpuset);
-1, cpusetsize, cpusetp);
if (error == -1)
error = errno;
} else {
@ -58,7 +58,7 @@ _pthread_setaffinity_np(pthread_t td, size_t cpusetsize, const cpuset_t *cpuset)
}
tid = TID(td);
error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, tid,
cpusetsize, cpuset);
cpusetsize, cpusetp);
if (error == -1)
error = errno;
THR_THREAD_UNLOCK(curthread, td);
@ -67,7 +67,7 @@ _pthread_setaffinity_np(pthread_t td, size_t cpusetsize, const cpuset_t *cpuset)
}
int
_pthread_getaffinity_np(pthread_t td, size_t cpusetsize, cpuset_t *cpuset)
_pthread_getaffinity_np(pthread_t td, size_t cpusetsize, cpuset_t *cpusetp)
{
struct pthread *curthread = _get_curthread();
lwpid_t tid;
@ -75,7 +75,7 @@ _pthread_getaffinity_np(pthread_t td, size_t cpusetsize, cpuset_t *cpuset)
tid = TID(td);
error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID,
(td == curthread) ? -1 : tid, cpusetsize, cpuset);
(td == curthread) ? -1 : tid, cpusetsize, cpusetp);
if (error == -1)
error = errno;
return (error);

View File

@ -569,7 +569,7 @@ _get_kern_cpuset_size(void)
__weak_reference(_pthread_attr_setaffinity_np, pthread_attr_setaffinity_np);
int
_pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,
const cpuset_t *cpuset)
const cpuset_t *cpusetp)
{
pthread_attr_t attr;
int ret;
@ -577,7 +577,7 @@ _pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,
if (pattr == NULL || (attr = (*pattr)) == NULL)
ret = EINVAL;
else {
if (cpusetsize == 0 || cpuset == NULL) {
if (cpusetsize == 0 || cpusetp == NULL) {
if (attr->cpuset != NULL) {
free(attr->cpuset);
attr->cpuset = NULL;
@ -591,7 +591,7 @@ _pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,
if (cpusetsize > kern_size) {
size_t i;
for (i = kern_size; i < cpusetsize; ++i) {
if (((char *)cpuset)[i])
if (((char *)cpusetp)[i])
return (EINVAL);
}
}
@ -605,7 +605,7 @@ _pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,
attr->cpusetsize - cpusetsize);
attr->cpusetsize = cpusetsize;
}
memcpy(attr->cpuset, cpuset, cpusetsize);
memcpy(attr->cpuset, cpusetp, cpusetsize);
ret = 0;
}
return (ret);
@ -614,7 +614,7 @@ _pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,
__weak_reference(_pthread_attr_getaffinity_np, pthread_attr_getaffinity_np);
int
_pthread_attr_getaffinity_np(const pthread_attr_t *pattr, size_t cpusetsize,
cpuset_t *cpuset)
cpuset_t *cpusetp)
{
pthread_attr_t attr;
int ret = 0;
@ -622,15 +622,15 @@ _pthread_attr_getaffinity_np(const pthread_attr_t *pattr, size_t cpusetsize,
if (pattr == NULL || (attr = (*pattr)) == NULL)
ret = EINVAL;
else if (attr->cpuset != NULL) {
memcpy(cpuset, attr->cpuset, MIN(cpusetsize, attr->cpusetsize));
memcpy(cpusetp, attr->cpuset, MIN(cpusetsize, attr->cpusetsize));
if (cpusetsize > attr->cpusetsize)
memset(((char *)cpuset) + attr->cpusetsize, 0,
memset(((char *)cpusetp) + attr->cpusetsize, 0,
cpusetsize - attr->cpusetsize);
} else {
size_t kern_size = _get_kern_cpuset_size();
memset(cpuset, -1, MIN(cpusetsize, kern_size));
memset(cpusetp, -1, MIN(cpusetsize, kern_size));
if (cpusetsize > kern_size)
memset(((char *)cpuset) + kern_size, 0,
memset(((char *)cpusetp) + kern_size, 0,
cpusetsize - kern_size);
}
return (ret);

View File

@ -56,7 +56,7 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
struct rtprio rtp;
int ret = 0, locked, create_suspended;
sigset_t set, oset;
cpuset_t *cpuset = NULL;
cpuset_t *cpusetp = NULL;
int cpusetsize = 0;
_thr_check_init();
@ -78,7 +78,7 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
new_thread->attr = _pthread_attr_default;
else {
new_thread->attr = *(*attr);
cpuset = new_thread->attr.cpuset;
cpusetp = new_thread->attr.cpuset;
cpusetsize = new_thread->attr.cpusetsize;
new_thread->attr.cpuset = NULL;
new_thread->attr.cpusetsize = 0;
@ -137,7 +137,7 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
_thr_link(curthread, new_thread);
/* Return thread pointer eariler so that new thread can use it. */
(*thread) = new_thread;
if (SHOULD_REPORT_EVENT(curthread, TD_CREATE) || cpuset != NULL) {
if (SHOULD_REPORT_EVENT(curthread, TD_CREATE) || cpusetp != NULL) {
THR_THREAD_LOCK(curthread, new_thread);
locked = 1;
} else
@ -201,9 +201,9 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
_thr_ref_delete_unlocked(curthread, new_thread);
THREAD_LIST_UNLOCK(curthread);
} else if (locked) {
if (cpuset != NULL) {
if (cpusetp != NULL) {
if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID,
TID(new_thread), cpusetsize, cpuset)) {
TID(new_thread), cpusetsize, cpusetp)) {
ret = errno;
/* kill the new thread */
new_thread->force_exit = 1;

View File

@ -63,16 +63,16 @@ static void init_spinlock(spinlock_t *lck);
void
_spinunlock(spinlock_t *lck)
{
struct spinlock_extra *extra;
struct spinlock_extra *_extra;
extra = (struct spinlock_extra *)lck->fname;
THR_UMUTEX_UNLOCK(_get_curthread(), &extra->lock);
_extra = (struct spinlock_extra *)lck->fname;
THR_UMUTEX_UNLOCK(_get_curthread(), &_extra->lock);
}
void
_spinlock(spinlock_t *lck)
{
struct spinlock_extra *extra;
struct spinlock_extra *_extra;
if (!__isthreaded)
PANIC("Spinlock called when not threaded.");
@ -80,8 +80,8 @@ _spinlock(spinlock_t *lck)
PANIC("Spinlocks not initialized.");
if (lck->fname == NULL)
init_spinlock(lck);
extra = (struct spinlock_extra *)lck->fname;
THR_UMUTEX_LOCK(_get_curthread(), &extra->lock);
_extra = (struct spinlock_extra *)lck->fname;
THR_UMUTEX_LOCK(_get_curthread(), &_extra->lock);
}
void