diff options
author | Denis Vlasenko | 2006-11-18 19:51:32 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-11-18 19:51:32 +0000 |
commit | 5a3395bc01cd4b11309595a6ecdaf32f8279f378 (patch) | |
tree | 1e63aa591a05e9ec75aefdcd639ca4188e583648 /networking/udhcp/static_leases.c | |
parent | abfc4cf6d8b9c59724aceb70df5081a1368fdb62 (diff) | |
download | busybox-5a3395bc01cd4b11309595a6ecdaf32f8279f378.zip busybox-5a3395bc01cd4b11309595a6ecdaf32f8279f378.tar.gz |
udhcp: fix indentation and style.
Eliminate (group) a lot of smallish *.h files
Remove lots of unneeded #includes
Diffstat (limited to 'networking/udhcp/static_leases.c')
-rw-r--r-- | networking/udhcp/static_leases.c | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/networking/udhcp/static_leases.c b/networking/udhcp/static_leases.c index 0d962c5..b53eac5 100644 --- a/networking/udhcp/static_leases.c +++ b/networking/udhcp/static_leases.c @@ -7,20 +7,15 @@ * */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "static_leases.h" +#include "common.h" #include "dhcpd.h" + /* Takes the address of the pointer to the static_leases linked list, * Address to a 6 byte mac address * Address to a 4 byte ip address */ int addStaticLease(struct static_lease **lease_struct, uint8_t *mac, uint32_t *ip) { - struct static_lease *cur; struct static_lease *new_static_lease; @@ -31,15 +26,11 @@ int addStaticLease(struct static_lease **lease_struct, uint8_t *mac, uint32_t *i new_static_lease->next = NULL; /* If it's the first node to be added... */ - if(*lease_struct == NULL) - { + if (*lease_struct == NULL) { *lease_struct = new_static_lease; - } - else - { + } else { cur = *lease_struct; - while(cur->next != NULL) - { + while (cur->next) { cur = cur->next; } @@ -47,7 +38,6 @@ int addStaticLease(struct static_lease **lease_struct, uint8_t *mac, uint32_t *i } return 1; - } /* Check to see if a mac has an associated static lease */ @@ -59,11 +49,9 @@ uint32_t getIpByMac(struct static_lease *lease_struct, void *arg) return_ip = 0; - while(cur != NULL) - { + while (cur) { /* If the client has the correct mac */ - if(memcmp(cur->mac, mac, 6) == 0) - { + if (memcmp(cur->mac, mac, 6) == 0) { return_ip = *(cur->ip); } @@ -71,7 +59,6 @@ uint32_t getIpByMac(struct static_lease *lease_struct, void *arg) } return return_ip; - } /* Check to see if an ip is reserved as a static ip */ @@ -81,17 +68,15 @@ uint32_t reservedIp(struct static_lease *lease_struct, uint32_t ip) uint32_t return_val = 0; - while(cur != NULL) - { + while (cur) { /* If the client has the correct ip */ - if(*cur->ip == ip) + if (*cur->ip == ip) return_val = 1; cur = cur->next; } return return_val; - } #ifdef CONFIG_FEATURE_UDHCP_DEBUG @@ -102,8 +87,7 @@ void printStaticLeases(struct static_lease **arg) /* Get a pointer to the linked list */ struct static_lease *cur = *arg; - while(cur != NULL) - { + while (cur) { /* printf("PrintStaticLeases: Lease mac Address: %x\n", cur->mac); */ printf("PrintStaticLeases: Lease mac Value: %x\n", *(cur->mac)); /* printf("PrintStaticLeases: Lease ip Address: %x\n", cur->ip); */ @@ -111,10 +95,5 @@ void printStaticLeases(struct static_lease **arg) cur = cur->next; } - - } #endif - - - |