Bugzilla Bug 352816: don't need to call _pr_CopyLowBits if size (free space
authorwtchang%redhat.com
Fri, 15 Sep 2006 16:48:50 +0000
changeset 3695 a62705c8b590c01781a7b0a4fa2cf979068d8fe6
parent 3693 6bb17dd81ceeda2bd2fd66806a397a62c9b54a95
child 3696 0ba1f1482ceae296f5c9a06fd9626aed1b9faecd
push idunknown
push userunknown
push dateunknown
bugs352816
Bugzilla Bug 352816: don't need to call _pr_CopyLowBits if size (free space in buf) is 0. The patch is contributed by Sergei Dolgov <sergei_d@fi.tartu.ee>. r=wtc.
pr/src/md/beos/brng.c
--- a/pr/src/md/beos/brng.c
+++ b/pr/src/md/beos/brng.c
@@ -52,21 +52,21 @@
 extern PRSize _PR_MD_GetRandomNoise( void *buf, PRSize size )
 {
     struct timeval tv;
     int n = 0;
     int s;
 
     GETTIMEOFDAY(&tv);
 
-    if ( size >= 0 ) {
+    if ( size > 0 ) {
         s = _pr_CopyLowBits((char*)buf+n, size, &tv.tv_usec, sizeof(tv.tv_usec));
         size -= s;
         n += s;
     }
-    if ( size >= 0 ) {
+    if ( size > 0 ) {
         s = _pr_CopyLowBits((char*)buf+n, size, &tv.tv_sec, sizeof(tv.tv_usec));
         size -= s;
         n += s;
     }
 
     return n;
 } /* end _PR_MD_GetRandomNoise() */