You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2007/09/28 05:14:08 UTC

svn commit: r580201 - in /webservices/axis2/trunk/c/util/src/platforms/unix: date_time_util_unix.c thread_unix.c uuid_gen_unix.c

Author: samisa
Date: Thu Sep 27 20:14:07 2007
New Revision: 580201

URL: http://svn.apache.org/viewvc?rev=580201&view=rev
Log:
Fixed indentation

Modified:
    webservices/axis2/trunk/c/util/src/platforms/unix/date_time_util_unix.c
    webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c
    webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c

Modified: webservices/axis2/trunk/c/util/src/platforms/unix/date_time_util_unix.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/unix/date_time_util_unix.c?rev=580201&r1=580200&r2=580201&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/unix/date_time_util_unix.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/unix/date_time_util_unix.c Thu Sep 27 20:14:07 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -17,14 +18,16 @@
 
 #include <platforms/unix/axutil_date_time_util_unix.h>
 
-AXIS2_EXTERN int AXIS2_CALL axis2_platform_get_milliseconds() 
+AXIS2_EXTERN int AXIS2_CALL
+axis2_platform_get_milliseconds(
+    )
 {
-   struct timeb t_current;
-   int milliseconds;
+    struct timeb t_current;
+    int milliseconds;
+
+    ftime(&t_current);
+    milliseconds = t_current.millitm;
 
-   ftime(&t_current);
-   milliseconds = t_current.millitm; 
- 
-   return milliseconds;
+    return milliseconds;
 
 }

Modified: webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c?rev=580201&r1=580200&r2=580201&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c Thu Sep 27 20:14:07 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -18,9 +19,9 @@
 #include <config.h>
 #include "axutil_thread_unix.h"
 
-
-AXIS2_EXTERN axutil_threadattr_t* AXIS2_CALL
-axutil_threadattr_create(axutil_allocator_t* allocator)
+AXIS2_EXTERN axutil_threadattr_t *AXIS2_CALL
+axutil_threadattr_create(
+    axutil_allocator_t * allocator)
 {
     int stat = 0;
     axutil_threadattr_t *new = NULL;
@@ -42,7 +43,8 @@
 
 /* Destroy the threadattr object */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-threadattr_cleanup(void *data)
+threadattr_cleanup(
+    void *data)
 {
     axutil_threadattr_t *attr = data;
     int rv;
@@ -59,7 +61,9 @@
 #define DETACH_ARG(v) ((v) ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE)
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_threadattr_detach_set(axutil_threadattr_t *attr, axis2_bool_t detached)
+axutil_threadattr_detach_set(
+    axutil_threadattr_t * attr,
+    axis2_bool_t detached)
 {
     if (0 == pthread_attr_setdetachstate(&(attr->attr), DETACH_ARG(detached)))
     {
@@ -69,7 +73,8 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_threadattr_detach_get(axutil_threadattr_t *attr)
+axutil_threadattr_detach_get(
+    axutil_threadattr_t * attr)
 {
     int state = 0;
     pthread_attr_getdetachstate(&(attr->attr), &state);
@@ -80,27 +85,32 @@
     return AXIS2_FALSE;
 }
 
-static void *dummy_worker(void *opaque)
+static void *
+dummy_worker(
+    void *opaque)
 {
-    axutil_thread_t *thread = (axutil_thread_t*)opaque;
+    axutil_thread_t *thread = (axutil_thread_t *) opaque;
     return thread->func(thread, thread->data);
 }
 
-AXIS2_EXTERN axutil_thread_t* AXIS2_CALL
-axutil_thread_create(axutil_allocator_t* allocator, axutil_threadattr_t *attr,
-    axutil_thread_start_t func, void *data)
+AXIS2_EXTERN axutil_thread_t *AXIS2_CALL
+axutil_thread_create(
+    axutil_allocator_t * allocator,
+    axutil_threadattr_t * attr,
+    axutil_thread_start_t func,
+    void *data)
 {
     axis2_status_t stat;
     pthread_attr_t *temp = NULL;
     axutil_thread_t *new = NULL;
 
-    new = (axutil_thread_t *)AXIS2_MALLOC(allocator, sizeof(axutil_thread_t));
+    new = (axutil_thread_t *) AXIS2_MALLOC(allocator, sizeof(axutil_thread_t));
 
     if (!new)
     {
         return NULL;
     }
-    new->td = (pthread_t *)AXIS2_MALLOC(allocator, sizeof(pthread_t));
+    new->td = (pthread_t *) AXIS2_MALLOC(allocator, sizeof(pthread_t));
     if (!new->td)
     {
         return NULL;
@@ -126,19 +136,24 @@
 }
 
 AXIS2_EXTERN axis2_os_thread_t AXIS2_CALL
-axis2_os_thread_current(void)
+axis2_os_thread_current(
+    void)
 {
     return pthread_self();
 }
 
 AXIS2_EXTERN int AXIS2_CALL
-axis2_os_thread_equal(axis2_os_thread_t tid1, axis2_os_thread_t tid2)
+axis2_os_thread_equal(
+    axis2_os_thread_t tid1,
+    axis2_os_thread_t tid2)
 {
     return pthread_equal(tid1, tid2);
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_thread_exit(axutil_thread_t *thd, axutil_allocator_t *allocator)
+axutil_thread_exit(
+    axutil_thread_t * thd,
+    axutil_allocator_t * allocator)
 {
     if (thd)
     {
@@ -153,10 +168,11 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_thread_join(axutil_thread_t *thd)
+axutil_thread_join(
+    axutil_thread_t * thd)
 {
     void *thread_stat;
-    if (0 == pthread_join(*(thd->td), (void *)(&thread_stat)))
+    if (0 == pthread_join(*(thd->td), (void *) (&thread_stat)))
     {
         return AXIS2_SUCCESS;
     }
@@ -164,7 +180,8 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_thread_detach(axutil_thread_t *thd)
+axutil_thread_detach(
+    axutil_thread_t * thd)
 {
     if (0 == pthread_detach(*(thd->td)))
     {
@@ -173,7 +190,9 @@
     return AXIS2_FAILURE;
 }
 
-void axutil_thread_yield(void)
+void
+axutil_thread_yield(
+    void)
 {
     return;
 }
@@ -185,13 +204,13 @@
  */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axutil_thread_key_create(
-    axutil_threadkey_t *axis2_key,
-    void (*destructor)(void *))
+    axutil_threadkey_t * axis2_key,
+    void (*destructor) (void *))
 {
     int rc = -1;
     pthread_key_t key = axis2_key->key;
     rc = pthread_key_create(&key, destructor);
-    if(0 == rc)
+    if (0 == rc)
         return AXIS2_SUCCESS;
     else
         return AXIS2_FAILURE;
@@ -201,9 +220,9 @@
  * This function is used to get the value of a given key
  * @return void*. A key's value is simply a void pointer (void*)
  */
-AXIS2_EXTERN void * AXIS2_CALL
+AXIS2_EXTERN void *AXIS2_CALL
 axutil_thread_getspecific(
-    axutil_threadkey_t *axis2_key)
+    axutil_threadkey_t * axis2_key)
 {
     void *value = NULL;
     pthread_key_t key = axis2_key->key;
@@ -218,20 +237,21 @@
  */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axutil_thread_setspecific(
-    axutil_threadkey_t *axis2_key,
+    axutil_threadkey_t * axis2_key,
     void *value)
 {
     int rc = -1;
     pthread_key_t key = axis2_key->key;
     rc = pthread_setspecific(key, value);
-    if(0 == rc)
+    if (0 == rc)
         return AXIS2_SUCCESS;
     else
         return AXIS2_FAILURE;
 }
 
-AXIS2_EXTERN axis2_os_thread_t* AXIS2_CALL
-axis2_os_thread_get(axutil_thread_t *thd)
+AXIS2_EXTERN axis2_os_thread_t *AXIS2_CALL
+axis2_os_thread_get(
+    axutil_thread_t * thd)
 {
     if (!thd)
     {
@@ -240,16 +260,17 @@
     return thd->td;
 }
 
-AXIS2_EXTERN axutil_thread_once_t* AXIS2_CALL
-axutil_thread_once_init(axutil_allocator_t* allocator)
+AXIS2_EXTERN axutil_thread_once_t *AXIS2_CALL
+axutil_thread_once_init(
+    axutil_allocator_t * allocator)
 {
 #ifdef AXIS2_SOLARIS
-    static const pthread_once_t once_init = {PTHREAD_ONCE_INIT};
+    static const pthread_once_t once_init = { PTHREAD_ONCE_INIT };
 #else
     static const pthread_once_t once_init = PTHREAD_ONCE_INIT;
 #endif
     axutil_thread_once_t *control = AXIS2_MALLOC(allocator,
-            sizeof(axutil_thread_once_t));
+                                                 sizeof(axutil_thread_once_t));
     if (!control)
     {
         return NULL;
@@ -260,14 +281,18 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_thread_once(axutil_thread_once_t *control, void(*func)(void))
+axutil_thread_once(
+    axutil_thread_once_t * control,
+    void (*func) (void))
 {
     return pthread_once(&(control->once), func);
 }
 
 /*************************Thread locking functions*****************************/
-AXIS2_EXTERN axutil_thread_mutex_t * AXIS2_CALL
-axutil_thread_mutex_create(axutil_allocator_t *allocator, unsigned int flags)
+AXIS2_EXTERN axutil_thread_mutex_t *AXIS2_CALL
+axutil_thread_mutex_create(
+    axutil_allocator_t * allocator,
+    unsigned int flags)
 {
     axutil_thread_mutex_t *new_mutex = NULL;
 
@@ -283,13 +308,15 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_thread_mutex_lock(axutil_thread_mutex_t *mutex)
+axutil_thread_mutex_lock(
+    axutil_thread_mutex_t * mutex)
 {
     return pthread_mutex_lock(&(mutex->mutex));
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_thread_mutex_unlock(axutil_thread_mutex_t *mutex)
+axutil_thread_mutex_unlock(
+    axutil_thread_mutex_t * mutex)
 {
     if (pthread_mutex_unlock(&(mutex->mutex)) != 0)
     {
@@ -299,7 +326,8 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_thread_mutex_destroy(axutil_thread_mutex_t *mutex)
+axutil_thread_mutex_destroy(
+    axutil_thread_mutex_t * mutex)
 {
     if (0 != pthread_mutex_destroy(&(mutex->mutex)))
     {
@@ -308,4 +336,3 @@
     AXIS2_FREE(mutex->allocator, mutex);
     return AXIS2_SUCCESS;
 }
-

Modified: webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c?rev=580201&r1=580200&r2=580201&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c Thu Sep 27 20:14:07 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -49,14 +50,13 @@
 #include <platforms/unix/axutil_uuid_gen_unix.h>
 #include <platforms/axutil_platform_auto_sense.h>
 
-
 /* We need these static variables to track throughout the program execution */
 static axis2_bool_t axutil_uuid_gen_is_first = AXIS2_TRUE;
 static struct axutil_uuid_st axutil_uuid_static;
 
-
-axutil_uuid_t* AXIS2_CALL
-axutil_uuid_gen_v1()
+axutil_uuid_t *AXIS2_CALL
+axutil_uuid_gen_v1(
+    )
 {
     struct timeval time_now;
     struct timeval tv;
@@ -84,30 +84,30 @@
         return NULL;
 
     /* check whether system time changed since last retrieve */
-    if (!(time_now.tv_sec  == axutil_uuid_static.time_last.tv_sec
-        && time_now.tv_usec ==
-        axutil_uuid_static.time_last.tv_usec))
+    if (!
+        (time_now.tv_sec == axutil_uuid_static.time_last.tv_sec &&
+         time_now.tv_usec == axutil_uuid_static.time_last.tv_usec))
     {
         /* reset time sequence counter and continue */
         axutil_uuid_static.time_seq = 0;
     }
 
     /* until we are out of UUIDs per tick, increment
-    the time/tick sequence counter and continue */
+       the time/tick sequence counter and continue */
     while (axutil_uuid_static.time_seq < UUIDS_PER_TICK)
     {
         axutil_uuid_static.time_seq++;
     }
     /* sleep for 1000ns (1us) */
-    tv.tv_sec  = 0;
+    tv.tv_sec = 0;
     tv.tv_usec = 1;
     /*
-        The following select causes severe performance problems. 
-        Hence commenting out. I am not sure why this is required. - Samisa.    
-    select(0, NULL, NULL, NULL, &tv);*/
+       The following select causes severe performance problems. 
+       Hence commenting out. I am not sure why this is required. - Samisa.    
+       select(0, NULL, NULL, NULL, &tv); */
 
-    time_val = (unsigned long long)time_now.tv_sec * 10000000ull;
-    time_val += (unsigned long long)time_now.tv_usec * 10ull;
+    time_val = (unsigned long long) time_now.tv_sec * 10000000ull;
+    time_val += (unsigned long long) time_now.tv_usec * 10ull;
 
     ret_uuid = malloc(sizeof(axutil_uuid_t));
 
@@ -115,33 +115,34 @@
     /* compensate for low resolution system clock by adding
        the time/tick sequence counter */
     if (axutil_uuid_static.time_seq > 0)
-        time_val += (unsigned long long)axutil_uuid_static.time_seq;
+        time_val += (unsigned long long) axutil_uuid_static.time_seq;
 
     time_val2 = time_val;
-    ret_uuid->time_low = (unsigned long)time_val2;
+    ret_uuid->time_low = (unsigned long) time_val2;
     time_val2 >>= 32;
-    ret_uuid->time_mid = (unsigned short int)time_val2;
+    ret_uuid->time_mid = (unsigned short int) time_val2;
     time_val2 >>= 16;
-    time_high_version = (unsigned short int)time_val2;
+    time_high_version = (unsigned short int) time_val2;
 
-    /* store the 60 LSB of the time in the UUID and make version 1*/
+    /* store the 60 LSB of the time in the UUID and make version 1 */
     time_high_version <<= 4;
     time_high_version &= 0xFFF0;
     time_high_version |= 0x0001;
     ret_uuid->time_high_version = time_high_version;
 
     /*
-      *  GENERATE CLOCK
-      */
+     *  GENERATE CLOCK
+     */
 
     /* retrieve current clock sequence */
     clck = axutil_uuid_static.clock;
 
     /* generate new random clock sequence (initially or if the
        time has stepped backwards) or else just increase it */
-    if (clck == 0 || (time_now.tv_sec < axutil_uuid_static.time_last.tv_sec ||
-        (time_now.tv_sec == axutil_uuid_static.time_last.tv_sec
-        && time_now.tv_usec < axutil_uuid_static.time_last.tv_usec)))
+    if (clck == 0 ||
+        (time_now.tv_sec < axutil_uuid_static.time_last.tv_sec ||
+         (time_now.tv_sec == axutil_uuid_static.time_last.tv_sec &&
+          time_now.tv_usec < axutil_uuid_static.time_last.tv_usec)))
     {
         srand(time_now.tv_usec);
         clck = rand();
@@ -162,10 +163,10 @@
      *  FINISH
      */
     /* remember current system time for next iteration */
-    axutil_uuid_static.time_last.tv_sec  = time_now.tv_sec;
+    axutil_uuid_static.time_last.tv_sec = time_now.tv_sec;
     axutil_uuid_static.time_last.tv_usec = time_now.tv_usec;
 
-    if (! ret_uuid)
+    if (!ret_uuid)
     {
         return NULL;
     }
@@ -174,44 +175,43 @@
     return ret_uuid;
 }
 
-
-axis2_char_t* AXIS2_CALL
-axutil_platform_uuid_gen(char *s)
+axis2_char_t *AXIS2_CALL
+axutil_platform_uuid_gen(
+    char *s)
 {
     axutil_uuid_t *uuid_struct = NULL;
     axis2_char_t *uuid_str = NULL;
     unsigned char mac[7];
     char mac_hex[13];
 
-    if (! s)
+    if (!s)
     {
         return NULL;
     }
     uuid_struct = axutil_uuid_gen_v1();
-    if (! uuid_struct)
+    if (!uuid_struct)
     {
         return NULL;
     }
     uuid_str = s;
-    if (! uuid_str)
+    if (!uuid_str)
     {
         return NULL;
     }
     memcpy(mac, uuid_struct->mac_addr, 6);
-    sprintf(mac_hex, "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3]
-        , mac[4], mac[5]);
-    sprintf(uuid_str, "%08x-%04x-%04x-%04x-%s", uuid_struct->time_low,
-        uuid_struct->time_mid, uuid_struct->time_high_version,
-        uuid_struct->clock_variant, mac_hex);
+    sprintf(mac_hex, "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+    sprintf(uuid_str, "%08x-%04x-%04x-%04x-%s", uuid_struct->time_low, uuid_struct->time_mid,
+            uuid_struct->time_high_version, uuid_struct->clock_variant, mac_hex);
     free(uuid_struct);
     uuid_struct = NULL;
     return uuid_str;
 }
 
-#ifdef HAVE_LINUX_IF_H   /* Linux */
+#ifdef HAVE_LINUX_IF_H          /* Linux */
 
-char * AXIS2_CALL
-axutil_uuid_get_mac_addr()
+char *AXIS2_CALL
+axutil_uuid_get_mac_addr(
+    )
 {
     struct ifreq ifr;
     struct ifreq *IFR;
@@ -231,13 +231,13 @@
     ioctl(s, SIOCGIFCONF, &ifc);
     IFR = ifc.ifc_req;
 
-    for(i = ifc.ifc_len/sizeof(struct ifreq); --i >=0; IFR++)
+    for (i = ifc.ifc_len / sizeof(struct ifreq); --i >= 0; IFR++)
     {
         strcpy(ifr.ifr_name, IFR->ifr_name);
-        /*sprintf(ifr.ifr_name, "eth0");*/
+        /*sprintf(ifr.ifr_name, "eth0"); */
         if (ioctl(s, SIOCGIFFLAGS, &ifr) == 0)
         {
-            if(!(ifr.ifr_flags & IFF_LOOPBACK))
+            if (!(ifr.ifr_flags & IFF_LOOPBACK))
             {
                 if (ioctl(s, SIOCGIFHWADDR, &ifr) == 0)
                 {
@@ -247,17 +247,17 @@
             }
         }
     }
-    buffer = (char*)malloc(6 * sizeof(char));
-    if(ok)
+    buffer = (char *) malloc(6 * sizeof(char));
+    if (ok)
     {
-        sa = (struct sockaddr *) & ifr.ifr_addr;
+        sa = (struct sockaddr *) &ifr.ifr_addr;
         for (i = 0; i < 6; i++)
-            buffer[i] = (unsigned char)(sa->sa_data[i] & 0xff);
+            buffer[i] = (unsigned char) (sa->sa_data[i] & 0xff);
     }
     else
     {
         for (i = 0; i < 6; i++)
-            buffer[i] = (unsigned char)((AXIS2_LOCAL_MAC_ADDR[i]) - '0');
+            buffer[i] = (unsigned char) ((AXIS2_LOCAL_MAC_ADDR[i]) - '0');
     }
     close(s);
     return buffer;
@@ -265,14 +265,15 @@
 
 #else
 
-#ifdef IS_MACOSX  /* Darwin */
+#ifdef IS_MACOSX                /* Darwin */
 
 #ifndef max
 # define        max(a,b)        ((a) > (b) ? (a) : (b))
-#endif /* !max */
+#endif                          /* !max */
 
-char * AXIS2_CALL
-axutil_uuid_get_mac_addr()
+char *AXIS2_CALL
+axutil_uuid_get_mac_addr(
+    )
 {
     struct ifaddrs *ifap;
     struct ifaddrs *ifap_head;
@@ -283,34 +284,35 @@
 
     if (getifaddrs(&ifap_head) < 0)
         return NULL;
-    for (ifap = ifap_head; ifap != NULL; ifap = ifap->ifa_next) 
+    for (ifap = ifap_head; ifap != NULL; ifap = ifap->ifa_next)
     {
-        if (ifap->ifa_addr != NULL && ifap->ifa_addr->sa_family == AF_LINK) 
+        if (ifap->ifa_addr != NULL && ifap->ifa_addr->sa_family == AF_LINK)
         {
-            sdl = (const struct sockaddr_dl *)(void *)ifap->ifa_addr;
-            ucp = (unsigned char *)(sdl->sdl_data + sdl->sdl_nlen);
-            if (sdl->sdl_alen > 0) 
+            sdl = (const struct sockaddr_dl *) (void *) ifap->ifa_addr;
+            ucp = (unsigned char *) (sdl->sdl_data + sdl->sdl_nlen);
+            if (sdl->sdl_alen > 0)
             {
-                data_ptr = malloc(6*sizeof(char));
+                data_ptr = malloc(6 * sizeof(char));
                 for (i = 0; i < 6 && i < sdl->sdl_alen; i++, ucp++)
-                    data_ptr[i] = (unsigned char)(*ucp & 0xff);
-                
+                    data_ptr[i] = (unsigned char) (*ucp & 0xff);
+
                 freeifaddrs(ifap_head);
                 return data_ptr;
             }
-         }
+        }
     }
     freeifaddrs(ifap_head);
     return NULL;
 }
-# else /* Solaris-ish */
+# else                          /* Solaris-ish */
 
 /* code modified from that posted on:
 * http://forum.sun.com/jive/thread.jspa?threadID=84804&tstart=30
 */
 
-char * AXIS2_CALL
-axutil_uuid_get_mac_addr()
+char *AXIS2_CALL
+axutil_uuid_get_mac_addr(
+    )
 {
     char hostname[MAXHOSTNAMELEN];
     char *data_ptr;
@@ -321,25 +323,26 @@
     int i;
 
     if (gethostname(hostname, sizeof(hostname)) < 0)
-    	return NULL;
+        return NULL;
     if ((he = gethostbyname(hostname)) == NULL)
-    	return NULL;
+        return NULL;
     if ((s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
-    	return NULL;
+        return NULL;
     memset(&ar, 0, sizeof(ar));
-    sa = (struct sockaddr_in *)((void *)&(ar.arp_pa));
+    sa = (struct sockaddr_in *) ((void *) &(ar.arp_pa));
     sa->sin_family = AF_INET;
     memcpy(&(sa->sin_addr), *(he->h_addr_list), sizeof(struct in_addr));
-    if (ioctl(s, SIOCGARP, &ar) < 0) {
-    	close(s);
-    	return NULL;
+    if (ioctl(s, SIOCGARP, &ar) < 0)
+    {
+        close(s);
+        return NULL;
     }
     close(s);
     if (!(ar.arp_flags & ATF_COM))
-    	return NULL;
-	data_ptr = malloc(6*sizeof(char));
+        return NULL;
+    data_ptr = malloc(6 * sizeof(char));
     for (i = 0; i < 6; i++)
-    	data_ptr[i] = (unsigned char)(ar.arp_ha.sa_data[i] & 0xff);
+        data_ptr[i] = (unsigned char) (ar.arp_ha.sa_data[i] & 0xff);
 
     return data_ptr;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org