rbb         99/10/16 14:09:16

  Modified:    src/lib/apr/inc apr_macro.h
  Log:
  Fix Greg's problems with my original macros.  It compiles cleanly,
  But I haven't executed this code.  I'll probably just start implementing
  the new functions now, so this will most likely not get executed before
  it gets ripped out, but it was fun while it lasted. :)
  
  Revision  Changes    Path
  1.4       +28 -21    apache-2.0/src/lib/apr/inc/apr_macro.h
  
  Index: apr_macro.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/inc/apr_macro.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- apr_macro.h       1999/10/16 14:06:59     1.3
  +++ apr_macro.h       1999/10/16 21:09:14     1.4
  @@ -67,9 +67,9 @@
   #ifndef _POSIX_THREAD_SAFE_FUNCTIONS
   #define SAFETY_LOCK(funcname, namestr) \
       { \
  -    if (lock_##func_name == NULL) \
  -        if (ap_create_lock(&lock_##func_name, APR_MUTEX, APR_INTRAPROCESS, \
  -        name_str, NULL) != APR_SUCCESS) \
  +    if (lock_##funcname == NULL) \
  +        if (ap_create_lock(&lock_##funcname, APR_MUTEX, APR_INTRAPROCESS, \
  +        namestr, NULL) != APR_SUCCESS) \
               return APR_NOTTHREADSAFE; \
       if (ap_lock(lock_##funcname) != APR_SUCCESS) \
           return APR_NOTTHREADSAFE; \
  @@ -88,52 +88,59 @@
   #endif
   
   #ifdef HAVE_GMTIME_R
  -#define GMTIME_R(x, y) gmtime_r(x, y);
  +#define GMTIME_R(x, y) gmtime_r(x, y)
   #else
  -#define GMTIME_R(x, y) memcpy(y, gmtime(x), sizeof(y));
  +#define GMTIME_R(x, y) memcpy(y, gmtime(x), sizeof(y))
   #endif
   
   #ifdef HAVE_LOCALTIME_R
  -#define LOCALTIME_R(x, y) localtime_r(x, y);
  +#define LOCALTIME_R(x, y) localtime_r(x, y)
   #else
  -#define LOCALTIME_R(x, y) memcpy(y, localtime(x), sizeof(y));
  +#define LOCALTIME_R(x, y) memcpy(y, localtime(x), sizeof(y))
   #endif
   
   #ifdef _POSIX_THREAD_SAFE_FUNCTIONS 
  -#define GETHOSTBYNAME(x, y, z) z = gethostbyname(x);
  +#define GETHOSTBYNAME(x, y, z) z = gethostbyname(x)
   #else
   #define GETHOSTBYNAME(x, y, z) \
  -            y = gethostbyname(x); \
  -            z = ap_palloc(NULL, sizeof(struct hostent)); \
  -            memcpy(z, y, sizeof(struct hostent));
  +            if (1) { \
  +                y = gethostbyname(x); \
  +                z = ap_palloc(NULL, sizeof(struct hostent)); \
  +                memcpy(z, y, sizeof(struct hostent)); \
  +            }
   #endif
   
   #ifdef _POSIX_THREAD_SAFE_FUNCTIONS 
  -#define GETHOSTBYADDR(x, y, z) z = gethostbyaddr(x, sizeof(struct in_addr), 
AF_INET);
  +#define GETHOSTBYADDR(x, y, z) z = gethostbyaddr(x, sizeof(struct in_addr), 
AF_INET)
   #else
   #define GETHOSTBYADDR(x, y, z) \
  -            y = gethostbyaddr(x, sizeof(struct in_addr), AF_INET); \
  -            z = ap_palloc(NULL, sizeof(struct hostent)); \
  -            memcpy(z, y, sizeof(struct hostent));
  +            if (1) { \
  +                y = gethostbyaddr(x, sizeof(struct in_addr), AF_INET); \
  +                z = ap_palloc(NULL, sizeof(struct hostent)); \
  +                memcpy(z, y, sizeof(struct hostent)); \
  +            }
   #endif
   
   #ifdef _POSIX_THREAD_SAFE_FUNCTIONS 
  -#define INET_NTOA(x, y, len) ap_cpystrn(y, inet_ntoa(x), len);
  +#define INET_NTOA(x, y, len) ap_cpystrn(y, inet_ntoa(x), len)
   #else
  -#define INET_NTOA(x, y, len) ap_cpystrn(y, inet_ntoa(x), len);
  +#define INET_NTOA(x, y, len) ap_cpystrn(y, inet_ntoa(x), len)
   #endif
   
   #ifdef _POSIX_THREAD_SAFE_FUNCTIONS 
  -#define READDIR(x, y, z)  y = readdir(x); \
  +#define READDIR(x, y, z)  \
  +                       if (1) { \
  +                           y = readdir(x); \
                              if (y == NULL) { \
                                  z = errno; \
                              } \
                              else { \
                                  z = APR_SUCCESS; \
  -                           }
  +                           }\
  +                       }
   #else
   #define READDIR(x, y, z) \
  -                          { \
  +                      if (1) { \
                             struct dirent *temp = readdir(x); \
                             if (temp == NULL) { \
                                 z = errno; \
  @@ -142,7 +149,7 @@
                                 memcpy(y, temp, sizeof(struct dirent)); \
                                 z = APR_SUCCESS; \
                             } \
  -                          }
  +                      }
   #endif
   
   #ifdef __cplusplus
  
  
  

Reply via email to