Commits

james woodyatt committed b78d89f

Adjust whitespace and make sure there are no warnings from the C compiler
about unused function parameters in primitives that take a unit parameter.

Comments (0)

Files changed (6)

     exnVal = alloc_small(1, 0);
     Store_field(exnVal, 0, *cf_tai64_range_error_exn);
     mlraise(exnVal);
-
+    
     CAMLreturn0;
 }
 
     exnVal = alloc_small(1, 0);
     Store_field(exnVal, 0, *cf_tai64_label_error_exn);
     caml_raise(exnVal);
-
+    
     CAMLreturn0;
 }
 
         x <<= 8;
         x |= (unsigned long long) ch;
     }
-
+    
     ((Cf_tai64_t*) data)->s = x;
     return 8;
 }
 {
     CAMLparam0();
     CAMLlocal1(result);
-
+    (void) unit;
+    
     Cf_tai64_t x;
     
     cf_tai64_update(&x);
 CAMLprim value cf_tai64_epoch(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(cf_tai64_epoch_val);
 }
 
 CAMLprim value cf_tai64_first(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(cf_tai64_first_val);
 }
 
 CAMLprim value cf_tai64_last(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(cf_tai64_last_val);
 }
 
 CAMLprim value cf_tai64_mjd_epoch(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(cf_tai64_mjd_epoch_val);
 }
 
 {
     CAMLparam1(v);
     CAMLlocal1(result);
-
+    
     static const double cf_tai64_unix_limit[2] = {
         -((double)CF_TAI64_EPOCH),
         ((double)(CF_TAI64_EPOCH << 1) - CF_TAI64_EPOCH - 1),
 {
     CAMLparam1(v);
     CAMLlocal1(result);
-
+    
     double x;
     uint64 epoch;
     
 {
     CAMLparam2(tai64Val, dtVal);
     CAMLlocal1(result);
-
+    
     Cf_tai64_t x;
     
     x.s = Cf_tai64_val(tai64Val)->s + Int_val(dtVal);
 {
     CAMLparam2(tai64Val, dt32Val);
     CAMLlocal1(result);
-
+    
     Cf_tai64_t x;
     
     x.s = Cf_tai64_val(tai64Val)->s + Int32_val(dt32Val);
 {
     CAMLparam2(tai64Val, dt64Val);
     CAMLlocal1(result);
-
+    
     Cf_tai64_t x;
     int64 dt64;
     
     static const Cf_tai64_t last = { (CF_TAI64_EPOCH << 1) - 1 };
     static const Cf_tai64_t mjd_epoch = { CF_TAI64_MJD_EPOCH };
     
+    (void) unit;
     register_custom_operations(&cf_tai64_op);
     
     register_global_root(&cf_tai64_epoch_val);
     int i;
     
     deserialize_block_1(buffer, 8);
-
+    
     x = 0ULL;
     for (i = 7; i >= 0; --i) {
         u_int8_t ch = (u_int8_t) buffer[i];
         y <<= 8;
         y |= (unsigned long long) ch;
     }
-
+    
     ((Cf_tai64n_t*) data)->s = x;
     ((Cf_tai64n_t*) data)->ns = y;
     return 12;
 
 /*---
   Set to current time
-
+    
     1972-01-01 00:00:00 UTC was 1972-01-01 00:00:10 TAI
     Unix time values include all currently defined leap seconds
   ---*/
 {
     CAMLparam0();
     CAMLlocal1(result);
-
+    (void) unit;
+    
     Cf_tai64n_t x;
     
     cf_tai64n_update(&x);
 CAMLprim value cf_tai64n_first(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(cf_tai64n_first_val);
 }
 
 CAMLprim value cf_tai64n_last(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(cf_tai64n_last_val);
 }
 
 {
     CAMLparam1(v);
     CAMLlocal1(result);
-
+    
     static const double cf_tai64_unix_limit[2] = {
         -((double)CF_TAI64_EPOCH),
         ((double)(CF_TAI64_EPOCH << 1) - CF_TAI64_EPOCH - 1),
 {
     CAMLparam1(v);
     CAMLlocal1(result);
-
+    
     double x, y;
     uint64 epoch;
     
 {
     CAMLparam2(tai64nVal, dtVal);
     CAMLlocal1(result);
-
+    
     Cf_tai64n_t tai64n;
     double zInt, zFrac;
     int64 x;
     int32 y;
-
+    
     zFrac = modf(Double_val(dtVal), &zInt);
     x = (int64) zInt;
     y = (int32) (zFrac * 1E9);
 {
     static const Cf_tai64n_t first = { 0ULL, 0UL };
     static const Cf_tai64n_t last = { (CF_TAI64_EPOCH << 1) - 1, 999999999UL };
-
-    register_custom_operations(&cf_tai64n_op);        
+    
+    (void) unit;
+    register_custom_operations(&cf_tai64n_op);
     
     register_global_root(&cf_tai64n_first_val);
     cf_tai64n_first_val = cf_tai64n_alloc(&first);
     
     register_global_root(&cf_tai64n_last_val);
     cf_tai64n_last_val = cf_tai64n_alloc(&last);
-
+    
     return Val_unit;
 }
 

nx/nx_ip4_addr_p.c

 
 #include <string.h>
 
-
 #define FAILWITH(S)	(failwith("Nx_ip4_addr." S))
 
 /*---------------------------------------------------------------------------*
 CAMLprim value nx_ip4_addr_any(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip4_addr_any_val);
 }
 
 CAMLprim value nx_ip4_addr_loopback(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip4_addr_loopback_val);
 }
 
 CAMLprim value nx_ip4_addr_broadcast(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip4_addr_broadcast_val);
 }
 
 CAMLprim value nx_ip4_addr_empty_group(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip4_addr_empty_group_val);
 }
 
 CAMLprim value nx_ip4_addr_all_hosts_group(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip4_addr_all_hosts_group_val);
 }
 
 CAMLprim value nx_ip4_addr_all_routers_group(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip4_addr_all_routers_group_val);
 }
 
        (networkPtr, (unsigned int) prefixLen, &min, &max);
     mask = ~(min.s_addr ^ max.s_addr);
     result = !!((networkPtr->s_addr & mask) == (addrPtr->s_addr & mask));
-
+    
     CAMLreturn(result ? Val_true : Val_false);
 }
     
    (value networkVal, value prefixLenVal, value dirVal, value addrVal)
 {
     CAMLparam4(networkVal, prefixLenVal, dirVal, addrVal);
-
+    
     int prefixLen, dir;
     struct in_addr* networkPtr;
     struct in_addr* addrPtr;
         
         network = networkPtr->s_addr;
         network = ntohl(network);
-    
+        
         if (
             (prefixLen < 24 && IN_CLASSC(network)) ||
             (prefixLen < 16 && IN_CLASSB(network)) ||
     CAMLreturn(copy_string(buffer));
 }
 
-
 /*---
   Initialization primitive
   ---*/
 CAMLprim value nx_ip4_addr_init(value unit)
 {
     struct in_addr addr;
-
+    
+    (void) unit;
     register_custom_operations(&nx_ip4_addr_op);
         
     addr.s_addr = htonl(INADDR_ANY);
     register_global_root(&nx_ip4_addr_any_val);
     nx_ip4_addr_any_val = nx_ip4_addr_alloc(&addr);
-
+    
     addr.s_addr = htonl(INADDR_LOOPBACK);
     register_global_root(&nx_ip4_addr_loopback_val);
     nx_ip4_addr_loopback_val = nx_ip4_addr_alloc(&addr);
-
+    
     addr.s_addr = htonl(INADDR_BROADCAST);
     register_global_root(&nx_ip4_addr_broadcast_val);
     nx_ip4_addr_broadcast_val = nx_ip4_addr_alloc(&addr);
-
+    
     addr.s_addr = htonl(INADDR_UNSPEC_GROUP);
     register_global_root(&nx_ip4_addr_empty_group_val);
     nx_ip4_addr_empty_group_val = nx_ip4_addr_alloc(&addr);
-
+    
     addr.s_addr = htonl(INADDR_ALLHOSTS_GROUP);
     register_global_root(&nx_ip4_addr_all_hosts_group_val);
     nx_ip4_addr_all_hosts_group_val = nx_ip4_addr_alloc(&addr);
-
+    
     addr.s_addr = htonl(INADDR_ALLRTRS_GROUP);
     register_global_root(&nx_ip4_addr_all_routers_group_val);
     nx_ip4_addr_all_routers_group_val = nx_ip4_addr_alloc(&addr);
-
+    
     return Val_unit;
 }
 

nx/nx_ip4_proto_p.c

 CAMLprim value nx_ip4_proto_domain(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip4_proto_domain_val);
 }
 
     ifrPtr = (struct ifreq*) buffer;
     strcpy(ifrPtr->ifr_name, String_val(nameVal));
     sockPtr = Nx_socket_val(sockVal);
-
+    
     v = ioctl(sockPtr->s_fd, SIOCGIFADDR, buffer);
     if (v == -1) unix_error(errno, "ioctl[SIOCGIFADDR]", Nothing);
-
+    
     sinPtr = (const struct sockaddr_in*) &ifrPtr->ifr_addr;
     resultVal = nx_ip4_addr_alloc(&sinPtr->sin_addr);
     CAMLreturn(resultVal);
     memset(&optval, 0, sizeof optval);
     optlen = sizeof optval;
     nx_socket_getsockopt_guard(contextPtr, &optval, &optlen);
-        
+    
     return Val_int(optval);
 }
 
     memset(&optval, 0, sizeof optval);
     optlen = sizeof optval;
     nx_socket_getsockopt_guard(contextPtr, &optval, &optlen);
-
+    
     multiaddrVal = nx_ip4_addr_alloc(&optval.imr_multiaddr);
     interfaceVal = nx_ip4_addr_alloc(&optval.imr_interface);
-
+    
     resultVal = alloc_small(2, 0);
     Field(resultVal, 0) = multiaddrVal;
     Field(resultVal, 0) = interfaceVal;
             nx_socket_getsockopt_int, nx_socket_setsockopt_int
         }
     },
-
+    
     { /* IP_ADD_MEMBERSHIP */
         Val_unit,
         {
             nx_ip4_proto_getsockopt_mreq, nx_ip4_proto_setsockopt_mreq
         }
     },
-
+    
     { /* IP_DROP_MEMBERSHIP */
         Val_unit,
         {
             nx_ip4_proto_getsockopt_mreq, nx_ip4_proto_setsockopt_mreq
         }
     },
-
+    
     { /* IP_MULTICAST_IF */
         Val_unit,
         {
             nx_ip4_proto_getsockopt_addr, nx_ip4_proto_setsockopt_addr
         }
     },
-
+    
     { /* IP_MULTICAST_TTL */
         Val_unit,
         {
             nx_ip4_proto_getsockopt_uchar, nx_ip4_proto_setsockopt_uchar
         }
     },
-
+    
     { /* IP_MULTICAST_LOOP */
         Val_unit,
         {
 CAMLprim value nx_ip4_proto_init(value unit)
 {
     int i;
-
+    
     static Nx_socket_domain_t domain = {
         PF_INET, AF_INET, nx_ip4_proto_sockaddr_cons,
         sizeof(struct sockaddr_in)
     };
-
+    
+    (void) unit;
     register_custom_operations(&nx_ip4_proto_sockaddr_op);
     
     register_global_root(&nx_ip4_proto_domain_val);
     nx_ip4_proto_domain_val = nx_socket_domain_alloc(&domain);
-
+    
     for (i = 0; i < NX_IP4_PROTO_SOCKOPT_LIFT_ARRAY_SIZE; ++i) {        
         Nx_socket_sockopt_lift_t* liftPtr;
         
         register_global_root(&liftPtr->ol_val);
         liftPtr->ol_val = nx_socket_option_alloc(&liftPtr->ol_option);
     }
-
+    
     return Val_unit;
 }
 

nx/nx_ip6_addr_p.c

     CAMLparam1(addr);
     
     const struct in6_addr* addr6Ptr = Nx_ip6_addr_val(addr);
-
+    
     if (nx_ip6_addr_format_code(addr6Ptr) != Nx_ip6_addr_unicast)
         FAILWITH("is_unicast");
     CAMLreturn(addr);
 CAMLprim value nx_ip6_addr_is_multicast(value addr)
 {
     CAMLparam1(addr);
-
+    
     const struct in6_addr* addr6Ptr = Nx_ip6_addr_val(addr);
-
+    
     if (nx_ip6_addr_format_code(addr6Ptr) != Nx_ip6_addr_multicast)
         FAILWITH("is_multicast");
     CAMLreturn(addr);
     }
     else /* word == 0 */ {
         int i;
-
+        
         result = Val_int(Nx_ip6_addr_U_reserved);
         
         for (i = 1; i < 3; ++i) {
     Store_field(resultVal, 0, scopeVal);
     Store_field(resultVal, 1, flagListVal);
     Store_field(resultVal, 2, groupIdVal);
-        
+    
     CAMLreturn(resultVal);
 }
 
     u_int8_t byte;
     
     addr.s6_addr[0] = 0xFF;
-
+    
     byte = 0;
     while (Is_block(flagListVal)) {        
         flagVal = Field(flagListVal, 0);
         
         flagListVal = Field(flagListVal, 1);
     }
-
+    
     byte |= nx_ip6_addr_multicast_scope_table.array[Int_val(scopeVal)];
     addr.s6_addr[1] = byte;
-
+    
     memcpy(&addr.s6_addr[2], &Nx_ip6_addr_val(groupIdVal)->s6_addr[2], 14);
     
     CAMLreturn(nx_ip6_addr_alloc(&addr));
 CAMLprim value nx_ip6_addr_unspecified(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip6_addr_unspecified_val);
 }
 
 CAMLprim value nx_ip6_addr_loopback(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip6_addr_loopback_val);
 }
 
 CAMLprim value nx_ip6_addr_node_local_all_nodes(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip6_addr_node_local_all_nodes_val);
 }
 
 CAMLprim value nx_ip6_addr_link_local_all_nodes(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip6_addr_link_local_all_nodes_val);
 }
 
 CAMLprim value nx_ip6_addr_link_local_all_routers(value unit)
 {
     CAMLparam0();
+    (void) unit;
     CAMLreturn(nx_ip6_addr_link_local_all_routers_val);
 }
 
 CAMLprim value nx_ip6_addr_equal(value addr1, value addr2)
 {
     CAMLparam2(addr1, addr2);
-
+    
     value result;
     
     if (IN6_ARE_ADDR_EQUAL(Nx_ip6_addr_val(addr1), Nx_ip6_addr_val(addr2)))
 {
     CAMLparam1(str);
     CAMLlocal1(resultVal);
-
+    
     struct in6_addr addr;
     int result;
     
   ---*/
 CAMLprim value nx_ip6_addr_init(value unit)
 {
+    (void) unit;
     register_custom_operations(&nx_ip6_addr_op);
         
     register_global_root(&nx_ip6_addr_unspecified_val);

nx/nx_ip_common_p.c

 CAMLprim value nx_ip_common_init(value unit)
 {
     int i;
-            
+    (void) unit;
+     
     for (i = 0; i < NX_IP_COMMON_SOCKOPT_LIFT_ARRAY_SIZE; ++i) {        
         Nx_socket_sockopt_lift_t* liftPtr;
         
         register_global_root(&liftPtr->ol_val);
         liftPtr->ol_val = nx_socket_option_alloc(&liftPtr->ol_option);
     }
-
+    
     return Val_unit;
 }