Commit bb77f843 authored by Rich Salz's avatar Rich Salz
Browse files

Add NOTTOOLONG macro for more clear code.



Also fix one missing use of it. Thanks to GitHub user Vort for finding
it and pointing out the fix.

Reviewed-by: default avatarAndy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4106)
parent a33a335e
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -196,6 +196,8 @@ typedef NET_API_STATUS(NET_API_FUNCTION *NETFREE) (LPBYTE);
#  endif                        /* 1 */
# endif                         /* !OPENSSL_SYS_WINCE */

#define NOTTOOLONG(start) ((GetTickCount() - (start)) < MAXDELAY)

int RAND_poll(void)
{
    MEMORYSTATUS m;
@@ -466,9 +468,7 @@ int RAND_poll(void)
                                do
                                    RAND_add(&hentry, hentry.dwSize, 5);
                                while (heap_next(&hentry)
                                       && (!good
                                           || (GetTickCount() - starttime) <
                                           MAXDELAY)
                                       && (!good || NOTTOOLONG(starttime))
                                       && --entrycnt > 0);
                            }
                        }
@@ -480,8 +480,7 @@ int RAND_poll(void)
                            ex_cnt_limit--;
                        }
                    } while (heaplist_next(handle, &hlist)
                             && (!good
                                 || (GetTickCount() - starttime) < MAXDELAY)
                             && (!good || NOTTOOLONG(starttime))
                             && ex_cnt_limit > 0);
                }
#  else
@@ -496,11 +495,11 @@ int RAND_poll(void)
                            do
                                RAND_add(&hentry, hentry.dwSize, 5);
                            while (heap_next(&hentry)
                                   && (!good || NOTTOOLONG(starttime))
                                   && --entrycnt > 0);
                        }
                    } while (heaplist_next(handle, &hlist)
                             && (!good
                                 || (GetTickCount() - starttime) < MAXDELAY));
                             && (!good || NOTTOOLONG(starttime)));
                }
#  endif

@@ -518,8 +517,7 @@ int RAND_poll(void)
                    do
                        RAND_add(&p, p.dwSize, 9);
                    while (process_next(handle, &p)
                           && (!good
                               || (GetTickCount() - starttime) < MAXDELAY));
                           && (!good || NOTTOOLONG(starttime)));

                /* thread walking */
                /*
@@ -533,8 +531,7 @@ int RAND_poll(void)
                    do
                        RAND_add(&t, t.dwSize, 6);
                    while (thread_next(handle, &t)
                           && (!good
                               || (GetTickCount() - starttime) < MAXDELAY));
                           && (!good || NOTTOOLONG(starttime)));

                /* module walking */
                /*
@@ -548,8 +545,7 @@ int RAND_poll(void)
                    do
                        RAND_add(&m, m.dwSize, 9);
                    while (module_next(handle, &m)
                           && (!good
                               || (GetTickCount() - starttime) < MAXDELAY));
                           && (!good || NOTTOOLONG(starttime)));
                if (close_snap)
                    close_snap(handle);
                else