Changeset 539 for trunk/src/sh_files.c


Ignore:
Timestamp:
Jan 7, 2019, 8:03:37 PM (6 years ago)
Author:
katerina
Message:

Fixes for tickets #431 (OpenBSD compatibility) and #432 (compiler warnings).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_files.c

    r516 r539  
    20462046#endif
    20472047
     2048/* This is the LCG from Numerical Recipies. Deterministic.
     2049 */
     2050static unsigned int simple_rand(unsigned int * state)
     2051{
     2052  *state = 1664525 * (*state) + 1013904223;
     2053  return *state;
     2054}
     2055
    20482056void * sh_dummy_dirlist;
    20492057void * sh_dummy_tmpcat;
     
    22902298    BREAKEXIT(sh_derr);
    22912299
    2292 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_RAND_R)
    2293     if (0 == (rand_r(&state) % 5)) (void) sh_derr();
    2294 #else
    2295     if (0 == state * (rand() % 5)) (void) sh_derr();
    2296 #endif
     2300    if (0 == (simple_rand(&state) % 5)) (void) sh_derr();
    22972301   
    22982302    /* ---- Check the file. ----
     
    26372641  BREAKEXIT(sh_derr);
    26382642
    2639 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_RAND_R)
    2640   if (0 == (rand_r(&state) % 2)) (void) sh_derr();
    2641 #else
    2642   if (0 == state * (rand() % 2)) (void) sh_derr();
    2643 #endif
     2643  if (0 == (simple_rand(&state) % 2)) (void) sh_derr();
    26442644
    26452645  if (dirName && infileName && (dirName[0] == '/') && (dirName[1] == '\0')
Note: See TracChangeset for help on using the changeset viewer.