[PATCH 1/2] dhcpv4-client: change coding style for passing NULL to time

Grant Erickson marathon96 at gmail.com
Tue Feb 28 09:55:52 PST 2012


Pass NULL rather than 0 when calling time(2) to follow prefered
stylistic convention.

--
diff --git a/gdhcp/client.c b/gdhcp/client.c
index a3b4b8a..fe60308 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -570,7 +570,7 @@ int g_dhcpv6_create_duid(GDHCPDuidType duid_type, int index, int type,
 		get_interface_mac_address(index, &(*duid)[2 + 2 + 4]);
 		(*duid)[2] = 0;
 		(*duid)[3] = type;
-		duid_time = time(0) - DUID_TIME_EPOCH;
+		duid_time = time(NULL) - DUID_TIME_EPOCH;
 		(*duid)[4] = duid_time >> 24;
 		(*duid)[5] = duid_time >> 16;
 		(*duid)[6] = duid_time >> 8;
@@ -896,7 +896,7 @@ GDHCPClient *g_dhcp_client_new(GDHCPType type,
 	dhcp_client->require_list = NULL;
 	dhcp_client->duid = NULL;
 	dhcp_client->duid_len = 0;
-	dhcp_client->last_renew = dhcp_client->last_rebind = time(0);
+	dhcp_client->last_renew = dhcp_client->last_rebind = time(NULL);
 	dhcp_client->expire = 0;
 
 	*error = G_DHCP_CLIENT_ERROR_NONE;
@@ -2554,7 +2554,7 @@ void g_dhcpv6_client_reset_renew(GDHCPClient *dhcp_client)
 	if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
 		return;
 
-	dhcp_client->last_renew = time(0);
+	dhcp_client->last_renew = time(NULL);
 }
 
 void g_dhcpv6_client_reset_rebind(GDHCPClient *dhcp_client)
@@ -2562,7 +2562,7 @@ void g_dhcpv6_client_reset_rebind(GDHCPClient *dhcp_client)
 	if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
 		return;
 
-	dhcp_client->last_rebind = time(0);
+	dhcp_client->last_rebind = time(NULL);
 }
 
 void g_dhcpv6_client_set_expire(GDHCPClient *dhcp_client, uint32_t timeout)
@@ -2570,7 +2570,7 @@ void g_dhcpv6_client_set_expire(GDHCPClient *dhcp_client, uint32_t timeout)
 	if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
 		return;
 
-	dhcp_client->expire = time(0) + timeout;
+	dhcp_client->expire = time(NULL) + timeout;
 }
 
 uint16_t g_dhcpv6_client_get_status(GDHCPClient *dhcp_client)
--
1.7.9.2 



More information about the connman mailing list