Changeset 131 for trunk/src/sh_error.c


Ignore:
Timestamp:
Oct 22, 2007, 11:19:15 PM (17 years ago)
Author:
rainer
Message:

Use thread-safe libc functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_error.c

    r86 r131  
    257257
    258258  do {
    259     if (num == 0)
    260       {
    261         p = strtok (c, " ,\t");
    262         ++num;
    263       }
    264     else
     259#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_STRTOK_R)
     260    char * saveptr;
     261    if (num == 0) {
     262      p = strtok_r (c, " ,\t", &saveptr);
     263      ++num;
     264    } else {
     265      p = strtok_r (NULL, " ,\t", &saveptr);
     266    }
     267#else
     268    if (num == 0) {
     269      p = strtok (c, " ,\t");
     270      ++num;
     271    } else {
    265272      p = strtok (NULL, " ,\t");
     273    }
     274#endif
    266275
    267276    if (p == NULL)
Note: See TracChangeset for help on using the changeset viewer.