Closed Bug 276170 Opened 20 years ago Closed 20 years ago

unused variable addrp in ptio.c

Categories

(NSPR :: NSPR, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: wtc)

References

()

Details

Attachments

(2 files)

/Users/timeless/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function `pt_Connect':
/Users/timeless/mozilla/nsprpub/pr/src/pthreads/ptio.c:1560: warning: unused
variable `addrp'
/Users/timeless/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function `pt_Bind':
/Users/timeless/mozilla/nsprpub/pr/src/pthreads/ptio.c:1745: warning: unused
variable `addrp'
/Users/timeless/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function `pt_SendTo':
/Users/timeless/mozilla/nsprpub/pr/src/pthreads/ptio.c:1995: warning: unused
variable `addrp'
Attachment #169678 - Flags: review?(wtchang)
Comment on attachment 169678 [details] [diff] [review]
only declare variable if it's going to be used

r=wtc.	I'll see if there is a better fix.

Thanks for the patch.
Attachment #169678 - Flags: review?(wtchang) → review+
The strategy of this fix is to use 'addrp' where
it is not being used now, so it is never an unused
variable.

I also found that the current code has a bug
(introduced when 'addrp' was added in rev. 3.42.4.4
on the NSPRPUB_RELEASE_4_0_BRANCH, which was carried
over to the trunk in rev. 3.43) in pt_Connect and
pt_SendTo when it is setting up the pt_Continuation
structure.  Using pt_Connect as an example:

#ifdef _PR_HAVE_SOCKADDR_LEN
	    op.arg2.buffer = (void*)&addrCopy;
#else
	    op.arg2.buffer = (void*)addr;
#endif

We should use 'addrp' instead of 'addr' in the #else
case.  This patch also fixes this problem.
Attachment #170197 - Flags: superreview?(darin)
Attachment #170197 - Flags: review?(timeless)
Attachment #170197 - Flags: superreview?(darin) → superreview+
Attachment #170197 - Flags: review?(timeless) → review+
I checked in the alternate patch on the NSPR trunk (NSPR 4.6)
and NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla 1.8 Alpha 6).
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: