summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvestre Ledru <sledru@mozilla.com>2017-06-07 15:23:43 +0200
committerSylvestre Ledru <sledru@mozilla.com>2017-06-07 15:23:43 +0200
commit863f2f8ecd326e113f896f1e8d6ced9d59af2788 (patch)
tree41c5fadb3fa08a91ffe04db35f80cfd9db3d10ff
parent5232d0ec078e3d1be2d2b59d057b9c39692359cb (diff)
downloadnspr-hg-863f2f8ecd326e113f896f1e8d6ced9d59af2788.tar.gz
Bug 1337449, Simplify the code by removing "} else {" after a break/return/continue, r=kaie
-rw-r--r--pr/src/io/prlayer.c51
-rw-r--r--pr/src/io/prmmap.c9
-rw-r--r--pr/src/io/prscanf.c8
-rw-r--r--pr/src/md/unix/unix.c22
-rw-r--r--pr/src/md/unix/uxproces.c18
-rw-r--r--pr/src/md/unix/uxshm.c44
-rw-r--r--pr/src/misc/prnetdb.c23
-rw-r--r--pr/src/misc/prtime.c37
-rw-r--r--pr/src/misc/prtpool.c18
-rw-r--r--pr/src/pthreads/ptio.c63
10 files changed, 145 insertions, 148 deletions
diff --git a/pr/src/io/prlayer.c b/pr/src/io/prlayer.c
index c01a2452..00da0287 100644
--- a/pr/src/io/prlayer.c
+++ b/pr/src/io/prlayer.c
@@ -47,7 +47,8 @@ static PRStatus PR_CALLBACK pl_TopClose (PRFileDesc *fd)
rv = fd->lower->methods->close(fd->lower);
_PR_DestroyIOLayer(fd);
return rv;
- } else if ((fd->higher) && (PR_IO_LAYER_HEAD == fd->higher->identity)) {
+ }
+ if ((fd->higher) && (PR_IO_LAYER_HEAD == fd->higher->identity)) {
/*
* lower layers of new style stack
*/
@@ -201,16 +202,16 @@ static PRFileDesc* PR_CALLBACK pl_TopAccept (
return NULL;
}
- if (newstyle_stack) {
- newstack->lower = newfd;
- newfd->higher = newstack;
- return newstack;
- } else {
- /* this PR_PushIOLayer call cannot fail */
- rv = PR_PushIOLayer(newfd, PR_TOP_IO_LAYER, newstack);
- PR_ASSERT(PR_SUCCESS == rv);
- return newfd; /* that's it */
- }
+ if (newstyle_stack)
+ {
+ newstack->lower = newfd;
+ newfd->higher = newstack;
+ return newstack;
+ }
+ /* this PR_PushIOLayer call cannot fail */
+ rv = PR_PushIOLayer(newfd, PR_TOP_IO_LAYER, newstack);
+ PR_ASSERT(PR_SUCCESS == rv);
+ return newfd; /* that's it */
}
static PRStatus PR_CALLBACK pl_DefBind (PRFileDesc *fd, const PRNetAddr *addr)
@@ -326,12 +327,11 @@ static PRInt32 PR_CALLBACK pl_DefAcceptread (
(*nd)->higher = newstack;
*nd = newstack;
return nbytes;
- } else {
- /* this PR_PushIOLayer call cannot fail */
- rv = PR_PushIOLayer(*nd, PR_TOP_IO_LAYER, newstack);
- PR_ASSERT(PR_SUCCESS == rv);
- return nbytes;
}
+ /* this PR_PushIOLayer call cannot fail */
+ rv = PR_PushIOLayer(*nd, PR_TOP_IO_LAYER, newstack);
+ PR_ASSERT(PR_SUCCESS == rv);
+ return nbytes;
}
static PRInt32 PR_CALLBACK pl_DefTransmitfile (
@@ -494,10 +494,9 @@ static PRStatus _PR_DestroyIOLayer(PRFileDesc *stack)
{
if (NULL == stack)
return PR_FAILURE;
- else {
- PR_DELETE(stack);
- return PR_SUCCESS;
- }
+
+ PR_DELETE(stack);
+ return PR_SUCCESS;
} /* _PR_DestroyIOLayer */
PR_IMPLEMENT(PRStatus) PR_PushIOLayer(
@@ -704,8 +703,8 @@ PR_IMPLEMENT(PRDescIdentity) PR_GetLayersIdentity(PRFileDesc* fd)
if (PR_IO_LAYER_HEAD == fd->identity) {
PR_ASSERT(NULL != fd->lower);
return fd->lower->identity;
- } else
- return fd->identity;
+ }
+ return fd->identity;
} /* PR_GetLayersIdentity */
PR_IMPLEMENT(PRFileDesc*) PR_GetIdentitiesLayer(PRFileDesc* fd, PRDescIdentity id)
@@ -713,10 +712,10 @@ PR_IMPLEMENT(PRFileDesc*) PR_GetIdentitiesLayer(PRFileDesc* fd, PRDescIdentity i
PRFileDesc *layer = fd;
if (PR_TOP_IO_LAYER == id) {
- if (PR_IO_LAYER_HEAD == fd->identity)
- return fd->lower;
- else
- return fd;
+ if (PR_IO_LAYER_HEAD == fd->identity) {
+ return fd->lower;
+ }
+ return fd;
}
for (layer = fd; layer != NULL; layer = layer->lower)
diff --git a/pr/src/io/prmmap.c b/pr/src/io/prmmap.c
index 6ffc1330..64f7ed4e 100644
--- a/pr/src/io/prmmap.c
+++ b/pr/src/io/prmmap.c
@@ -24,17 +24,16 @@ PR_IMPLEMENT(PRFileMap *) PR_CreateFileMap(
|| prot == PR_PROT_WRITECOPY);
fmap = PR_NEWZAP(PRFileMap);
if (NULL == fmap) {
- PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
- return NULL;
+ PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
+ return NULL;
}
fmap->fd = fd;
fmap->prot = prot;
if (_PR_MD_CREATE_FILE_MAP(fmap, size) == PR_SUCCESS) {
- return fmap;
- } else {
+ return fmap;
+ }
PR_DELETE(fmap);
return NULL;
- }
}
PR_IMPLEMENT(PRInt32) PR_GetMemMapAlignment(void)
diff --git a/pr/src/io/prscanf.c b/pr/src/io/prscanf.c
index 9d75d824..377a6e64 100644
--- a/pr/src/io/prscanf.c
+++ b/pr/src/io/prscanf.c
@@ -409,7 +409,8 @@ Convert(ScanfState *state, const char *fmt)
ch = GET(state);
if (ch == EOF) {
return NULL;
- } else if (state->assign) {
+ }
+ if (state->assign) {
*cArg++ = ch;
}
}
@@ -602,10 +603,9 @@ StringGetChar(void *stream)
if (*cPtr == '\0') {
return EOF;
- } else {
- *((char **) stream) = cPtr + 1;
- return (unsigned char) *cPtr;
}
+ *((char **) stream) = cPtr + 1;
+ return (unsigned char) *cPtr;
}
static void
diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c
index fdae1199..662f561b 100644
--- a/pr/src/md/unix/unix.c
+++ b/pr/src/md/unix/unix.c
@@ -3316,11 +3316,11 @@ int _MD_unix_get_nonblocking_connect_error(int osfd)
return errno;
} else {
return err;
- }
+ }
}
} else {
return ECONNREFUSED;
- }
+ }
#elif defined(UNIXWARE)
/*
* getsockopt() fails with EPIPE, so use getmsg() instead.
@@ -3331,17 +3331,17 @@ int _MD_unix_get_nonblocking_connect_error(int osfd)
rv = getmsg(osfd, NULL, NULL, &flags);
PR_ASSERT(-1 == rv || 0 == rv);
if (-1 == rv && errno != EAGAIN && errno != EWOULDBLOCK) {
- return errno;
+ return errno;
}
- return 0; /* no error */
+ return 0; /* no error */
#else
- int err;
- _PRSockLen_t optlen = sizeof(err);
- if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &optlen) == -1) {
- return errno;
- } else {
- return err;
- }
+ int err;
+ _PRSockLen_t optlen = sizeof(err);
+ if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char*)&err, &optlen) == -1) {
+ return errno;
+ }
+ return err;
+
#endif
}
diff --git a/pr/src/md/unix/uxproces.c b/pr/src/md/unix/uxproces.c
index a3b35e54..cc991298 100644
--- a/pr/src/md/unix/uxproces.c
+++ b/pr/src/md/unix/uxproces.c
@@ -247,13 +247,14 @@ ForkAndExec(
PR_DELETE(newEnvp);
}
return NULL;
- } else if (0 == process->md.pid) { /* the child process */
- /*
- * If the child process needs to exit, it must call _exit().
- * Do not call exit(), because exit() will flush and close
- * the standard I/O file descriptors, and hence corrupt
- * the parent process's standard I/O data structures.
- */
+ }
+ if (0 == process->md.pid) { /* the child process */
+ /*
+ * If the child process needs to exit, it must call _exit().
+ * Do not call exit(), because exit() will flush and close
+ * the standard I/O file descriptors, and hence corrupt
+ * the parent process's standard I/O data structures.
+ */
#if !defined(NTO) && !defined(SYMBIAN)
if (attr) {
@@ -498,10 +499,9 @@ ExtractExitStatus(int rawExitStatus)
#endif
if (WIFEXITED(rawExitStatus)) {
return WEXITSTATUS(rawExitStatus);
- } else {
+ }
PR_ASSERT(WIFSIGNALED(rawExitStatus));
return _PR_SIGNALED_EXITSTATUS;
- }
}
static void
diff --git a/pr/src/md/unix/uxshm.c b/pr/src/md/unix/uxshm.c
index dec4e3a7..54e68191 100644
--- a/pr/src/md/unix/uxshm.c
+++ b/pr/src/md/unix/uxshm.c
@@ -76,8 +76,8 @@ extern PRSharedMemory * _MD_OpenSharedMemory(
/* copy args to struct */
strcpy( shm->ipcname, ipcname );
- shm->size = size;
- shm->mode = mode;
+ shm->size = size;
+ shm->mode = mode;
shm->flags = flags;
shm->ident = _PR_SHM_IDENT;
@@ -500,30 +500,32 @@ extern PRFileMap* _md_OpenAnonFileMap(
("_md_OpenAnonFileMap(): PR_snprintf(): failed, generating filename"));
goto Finished;
}
-
+
/* create the file */
- osfd = open( genName, (O_CREAT | O_EXCL | O_RDWR), mode );
- if ( -1 == osfd ) {
- if ( EEXIST == errno ) {
- PR_smprintf_free( genName );
- continue; /* name exists, try again */
- } else {
- _PR_MD_MAP_OPEN_ERROR( errno );
- PR_LOG( _pr_shma_lm, PR_LOG_DEBUG,
- ("_md_OpenAnonFileMap(): open(): failed, filename: %s, errno: %d",
- genName, PR_GetOSError()));
- PR_smprintf_free( genName );
- goto Finished;
- }
+ osfd = open(genName, (O_CREAT | O_EXCL | O_RDWR), mode);
+ if (-1 == osfd) {
+ if (EEXIST == errno) {
+ PR_smprintf_free(genName);
+ continue; /* name exists, try again */
+ }
+ _PR_MD_MAP_OPEN_ERROR(errno);
+ PR_LOG(
+ _pr_shma_lm,
+ PR_LOG_DEBUG,
+ ("_md_OpenAnonFileMap(): open(): failed, filename: %s, errno: %d",
+ genName,
+ PR_GetOSError()));
+ PR_smprintf_free(genName);
+ goto Finished;
}
break; /* name generation and open successful, break; */
} /* end for() */
- if ( incr == maxTries ) {
- PR_ASSERT( -1 == osfd );
- PR_ASSERT( EEXIST == errno );
- _PR_MD_MAP_OPEN_ERROR( errno );
- goto Finished;
+ if (incr == maxTries) {
+ PR_ASSERT(-1 == osfd);
+ PR_ASSERT(EEXIST == errno);
+ _PR_MD_MAP_OPEN_ERROR(errno);
+ goto Finished;
}
urc = unlink( genName );
diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c
index 1eb4348d..affebf6a 100644
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -1483,18 +1483,20 @@ PR_IsNetAddrType(const PRNetAddr *addr, PRNetAddrValue val)
if (val == PR_IpAddrAny) {
if (_PR_IN6_IS_ADDR_UNSPECIFIED((PRIPv6Addr *)&addr->ipv6.ip)) {
return PR_TRUE;
- } else if (_PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)
- && _PR_IN6_V4MAPPED_TO_IPADDR((PRIPv6Addr *)&addr->ipv6.ip)
- == htonl(INADDR_ANY)) {
- return PR_TRUE;
+ }
+ if (_PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)
+ && _PR_IN6_V4MAPPED_TO_IPADDR((PRIPv6Addr *)&addr->ipv6.ip)
+ == htonl(INADDR_ANY)) {
+ return PR_TRUE;
}
} else if (val == PR_IpAddrLoopback) {
if (_PR_IN6_IS_ADDR_LOOPBACK((PRIPv6Addr *)&addr->ipv6.ip)) {
return PR_TRUE;
- } else if (_PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)
- && _PR_IN6_V4MAPPED_TO_IPADDR((PRIPv6Addr *)&addr->ipv6.ip)
- == htonl(INADDR_LOOPBACK)) {
- return PR_TRUE;
+ }
+ if (_PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)
+ && _PR_IN6_V4MAPPED_TO_IPADDR((PRIPv6Addr *)&addr->ipv6.ip)
+ == htonl(INADDR_LOOPBACK)) {
+ return PR_TRUE;
}
} else if (val == PR_IpAddrV4Mapped
&& _PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)) {
@@ -1504,8 +1506,9 @@ PR_IsNetAddrType(const PRNetAddr *addr, PRNetAddrValue val)
if (addr->raw.family == AF_INET) {
if (val == PR_IpAddrAny && addr->inet.ip == htonl(INADDR_ANY)) {
return PR_TRUE;
- } else if (val == PR_IpAddrLoopback
- && addr->inet.ip == htonl(INADDR_LOOPBACK)) {
+ }
+ if (val == PR_IpAddrLoopback
+ && addr->inet.ip == htonl(INADDR_LOOPBACK)) {
return PR_TRUE;
}
}
diff --git a/pr/src/misc/prtime.c b/pr/src/misc/prtime.c
index b5423228..f0378609 100644
--- a/pr/src/misc/prtime.c
+++ b/pr/src/misc/prtime.c
@@ -279,8 +279,7 @@ static int IsLeapYear(PRInt16 year)
{
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
return 1;
- else
- return 0;
+ return 0;
}
/*
@@ -1236,7 +1235,7 @@ PR_ParseTimeStringToExplodedTime(
if ((end - rest) > 2)
/* it is [0-9][0-9][0-9]+: */
break;
- else if ((end - rest) == 2)
+ if ((end - rest) == 2)
tmp_hour = ((rest[0]-'0')*10 +
(rest[1]-'0'));
else
@@ -1251,12 +1250,12 @@ PR_ParseTimeStringToExplodedTime(
if (end == rest)
/* no digits after first colon? */
break;
- else if ((end - rest) > 2)
+ if ((end - rest) > 2)
/* it is [0-9][0-9][0-9]+: */
break;
- else if ((end - rest) == 2)
+ if ((end - rest) == 2)
tmp_min = ((rest[0]-'0')*10 +
- (rest[1]-'0'));
+ (rest[1]-'0'));
else
tmp_min = (rest[0]-'0');
@@ -1274,7 +1273,7 @@ PR_ParseTimeStringToExplodedTime(
else if ((end - rest) > 2)
/* it is [0-9][0-9][0-9]+: */
break;
- else if ((end - rest) == 2)
+ if ((end - rest) == 2)
tmp_sec = ((rest[0]-'0')*10 +
(rest[1]-'0'));
else
@@ -1308,7 +1307,7 @@ PR_ParseTimeStringToExplodedTime(
rest = end;
break;
}
- else if ((*end == '/' || *end == '-') &&
+ if ((*end == '/' || *end == '-') &&
end[1] >= '0' && end[1] <= '9')
{
/* Perhaps this is 6/16/95, 16/6/95, 6-16-95, or 16-6-95
@@ -2014,24 +2013,22 @@ pr_WeekOfYear(const PRExplodedTime* time, unsigned int firstDayOfWeek)
dayOfWeek = time->tm_wday - firstDayOfWeek;
if (dayOfWeek < 0)
dayOfWeek += 7;
-
- dayOfYear = time->tm_yday - dayOfWeek;
+ dayOfYear = time->tm_yday - dayOfWeek;
if( dayOfYear <= 0 )
{
/* If dayOfYear is <= 0, it is in the first partial week of the year. */
return 0;
}
- else
- {
- /* Count the number of full weeks ( dayOfYear / 7 ) then add a week if there
- * are any days left over ( dayOfYear % 7 ). Because we are only counting to
- * the first day of the week containing the given time, rather than to the
- * actual day representing the given time, any days in week 0 will be "absorbed"
- * as extra days in the given week.
- */
- return (dayOfYear / 7) + ( (dayOfYear % 7) == 0 ? 0 : 1 );
- }
+
+ /* Count the number of full weeks ( dayOfYear / 7 ) then add a week if there
+ * are any days left over ( dayOfYear % 7 ). Because we are only counting to
+ * the first day of the week containing the given time, rather than to the
+ * actual day representing the given time, any days in week 0 will be "absorbed"
+ * as extra days in the given week.
+ */
+ return (dayOfYear / 7) + ( (dayOfYear % 7) == 0 ? 0 : 1 );
+
}
diff --git a/pr/src/misc/prtpool.c b/pr/src/misc/prtpool.c
index 0671cc19..c2cc9c80 100644
--- a/pr/src/misc/prtpool.c
+++ b/pr/src/misc/prtpool.c
@@ -862,16 +862,16 @@ PR_QueueJob_Connect(PRThreadPool *tpool, PRJobIoDesc *iod,
if ((rv == PR_FAILURE) && ((err = PR_GetError()) == PR_IN_PROGRESS_ERROR)){
/* connection pending */
return(queue_io_job(tpool, iod, fn, arg, joinable, JOB_IO_CONNECT));
- } else {
- /*
- * connection succeeded or failed; add to jobq right away
- */
- if (rv == PR_FAILURE)
- iod->error = err;
- else
- iod->error = 0;
- return(PR_QueueJob(tpool, fn, arg, joinable));
}
+ /*
+ * connection succeeded or failed; add to jobq right away
+ */
+ if (rv == PR_FAILURE)
+ iod->error = err;
+ else
+ iod->error = 0;
+ return(PR_QueueJob(tpool, fn, arg, joinable));
+
}
/* queue a job, when a timer expires */
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
index 53206bd1..9dde0319 100644
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -824,7 +824,7 @@ retry:
op->arg3.amount -= bytes; /* and reduce the required count */
return (0 == op->arg3.amount) ? PR_TRUE : PR_FALSE;
}
- else if ((EWOULDBLOCK != op->syserrno) && (EAGAIN != op->syserrno))
+ if ((EWOULDBLOCK != op->syserrno) && (EAGAIN != op->syserrno))
{
op->result.code = -1;
return PR_TRUE;
@@ -853,7 +853,7 @@ static PRBool pt_write_cont(pt_Continuation *op, PRInt16 revents)
op->arg3.amount -= bytes; /* and reduce the required count */
return (0 == op->arg3.amount) ? PR_TRUE : PR_FALSE;
}
- else if ((EWOULDBLOCK != op->syserrno) && (EAGAIN != op->syserrno))
+ if ((EWOULDBLOCK != op->syserrno) && (EAGAIN != op->syserrno))
{
op->result.code = -1;
return PR_TRUE;
@@ -895,7 +895,7 @@ static PRBool pt_writev_cont(pt_Continuation *op, PRInt16 revents)
op->arg3.amount -= iov_index; /* and array length */
return (0 == op->arg3.amount) ? PR_TRUE : PR_FALSE;
}
- else if ((EWOULDBLOCK != op->syserrno) && (EAGAIN != op->syserrno))
+ if ((EWOULDBLOCK != op->syserrno) && (EAGAIN != op->syserrno))
{
op->result.code = -1;
return PR_TRUE;
@@ -918,7 +918,7 @@ static PRBool pt_sendto_cont(pt_Continuation *op, PRInt16 revents)
op->arg3.amount -= bytes; /* and reduce the required count */
return (0 == op->arg3.amount) ? PR_TRUE : PR_FALSE;
}
- else if ((EWOULDBLOCK != op->syserrno) && (EAGAIN != op->syserrno))
+ if ((EWOULDBLOCK != op->syserrno) && (EAGAIN != op->syserrno))
{
op->result.code = -1;
return PR_TRUE;
@@ -2874,22 +2874,21 @@ static PRStatus pt_GetSockName(PRFileDesc *fd, PRNetAddr *addr)
if (rv == -1) {
pt_MapError(_PR_MD_MAP_GETSOCKNAME_ERROR, errno);
return PR_FAILURE;
- } else {
+ }
#ifdef _PR_HAVE_SOCKADDR_LEN
- /* ignore the sa_len field of struct sockaddr */
- if (addr)
- {
- addr->raw.family = ((struct sockaddr*)addr)->sa_family;
- }
+ /* ignore the sa_len field of struct sockaddr */
+ if (addr)
+ {
+ addr->raw.family = ((struct sockaddr*)addr)->sa_family;
+ }
#endif /* _PR_HAVE_SOCKADDR_LEN */
#ifdef _PR_INET6
- if (AF_INET6 == addr->raw.family)
- addr->raw.family = PR_AF_INET6;
+ if (AF_INET6 == addr->raw.family)
+ addr->raw.family = PR_AF_INET6;
#endif
- PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
- PR_ASSERT(IsValidNetAddrLen(addr, addr_len) == PR_TRUE);
- return PR_SUCCESS;
- }
+ PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
+ PR_ASSERT(IsValidNetAddrLen(addr, addr_len) == PR_TRUE);
+ return PR_SUCCESS;
} /* pt_GetSockName */
static PRStatus pt_GetPeerName(PRFileDesc *fd, PRNetAddr *addr)
@@ -2905,22 +2904,21 @@ static PRStatus pt_GetPeerName(PRFileDesc *fd, PRNetAddr *addr)
if (rv == -1) {
pt_MapError(_PR_MD_MAP_GETPEERNAME_ERROR, errno);
return PR_FAILURE;
- } else {
+ }
#ifdef _PR_HAVE_SOCKADDR_LEN
- /* ignore the sa_len field of struct sockaddr */
- if (addr)
- {
- addr->raw.family = ((struct sockaddr*)addr)->sa_family;
- }
+ /* ignore the sa_len field of struct sockaddr */
+ if (addr)
+ {
+ addr->raw.family = ((struct sockaddr*)addr)->sa_family;
+ }
#endif /* _PR_HAVE_SOCKADDR_LEN */
#ifdef _PR_INET6
- if (AF_INET6 == addr->raw.family)
- addr->raw.family = PR_AF_INET6;
+ if (AF_INET6 == addr->raw.family)
+ addr->raw.family = PR_AF_INET6;
#endif
- PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
- PR_ASSERT(IsValidNetAddrLen(addr, addr_len) == PR_TRUE);
- return PR_SUCCESS;
- }
+ PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
+ PR_ASSERT(IsValidNetAddrLen(addr, addr_len) == PR_TRUE);
+ return PR_SUCCESS;
} /* pt_GetPeerName */
static PRStatus pt_GetSocketOption(PRFileDesc *fd, PRSocketOptionData *data)
@@ -3713,8 +3711,8 @@ PR_IMPLEMENT(PRStatus) PR_Delete(const char *name)
if (rv == -1) {
pt_MapError(_PR_MD_MAP_UNLINK_ERROR, errno);
return PR_FAILURE;
- } else
- return PR_SUCCESS;
+ }
+ return PR_SUCCESS;
} /* PR_Delete */
PR_IMPLEMENT(PRStatus) PR_Access(const char *name, PRAccessHow how)
@@ -3838,11 +3836,10 @@ PR_IMPLEMENT(PRStatus) PR_RmDir(const char *name)
rv = rmdir(name);
if (0 == rv) {
- return PR_SUCCESS;
- } else {
+ return PR_SUCCESS;
+ }
pt_MapError(_PR_MD_MAP_RMDIR_ERROR, errno);
return PR_FAILURE;
- }
} /* PR_Rmdir */