[Olsr-cvs] olsrd-current/src neighbor_table.c, 1.32, 1.33 neighbor_table.h, 1.14, 1.15
Bernd Petrovitsch
(spam-protected)
Thu Aug 2 23:57:08 CEST 2007
Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1703/src
Modified Files:
neighbor_table.c neighbor_table.h
Log Message:
* const-ify parameters
* pave the way to add -Wshadow
Index: neighbor_table.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** neighbor_table.h 29 May 2005 12:47:45 -0000 1.14
--- neighbor_table.h 2 Aug 2007 21:57:06 -0000 1.15
***************
*** 87,103 ****
struct neighbor_2_list_entry *
! olsr_lookup_my_neighbors(struct neighbor_entry *, union olsr_ip_addr *);
int
! olsr_delete_neighbor_table(union olsr_ip_addr *);
struct neighbor_entry *
! olsr_insert_neighbor_table(union olsr_ip_addr *);
struct neighbor_entry *
! olsr_lookup_neighbor_table(union olsr_ip_addr *);
struct neighbor_entry *
! olsr_lookup_neighbor_table_alias(union olsr_ip_addr *);
void
--- 87,103 ----
struct neighbor_2_list_entry *
! olsr_lookup_my_neighbors(const struct neighbor_entry *, const union olsr_ip_addr *);
int
! olsr_delete_neighbor_table(const union olsr_ip_addr *);
struct neighbor_entry *
! olsr_insert_neighbor_table(const union olsr_ip_addr *);
struct neighbor_entry *
! olsr_lookup_neighbor_table(const union olsr_ip_addr *);
struct neighbor_entry *
! olsr_lookup_neighbor_table_alias(const union olsr_ip_addr *);
void
Index: neighbor_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** neighbor_table.c 25 Apr 2007 22:08:09 -0000 1.32
--- neighbor_table.c 2 Aug 2007 21:57:06 -0000 1.33
***************
*** 90,95 ****
while(entry != &neighbor->neighbor_2_list)
! {
!
if(COMP_IP(&entry->neighbor_2->neighbor_2_addr, address))
{
--- 90,94 ----
while(entry != &neighbor->neighbor_2_list)
! {
if(COMP_IP(&entry->neighbor_2->neighbor_2_addr, address))
{
***************
*** 118,124 ****
*/
struct neighbor_2_list_entry *
! olsr_lookup_my_neighbors(struct neighbor_entry *neighbor, union olsr_ip_addr *neighbor_main_address)
{
-
struct neighbor_2_list_entry *entry;
--- 117,122 ----
*/
struct neighbor_2_list_entry *
! olsr_lookup_my_neighbors(const struct neighbor_entry *neighbor, const union olsr_ip_addr *neighbor_main_address)
{
struct neighbor_2_list_entry *entry;
***************
*** 148,152 ****
int
! olsr_delete_neighbor_table(union olsr_ip_addr *neighbor_addr)
{
struct neighbor_2_list_entry *two_hop_list, *two_hop_to_delete;
--- 146,150 ----
int
! olsr_delete_neighbor_table(const union olsr_ip_addr *neighbor_addr)
{
struct neighbor_2_list_entry *two_hop_list, *two_hop_to_delete;
***************
*** 179,185 ****
while(two_hop_list != &entry->neighbor_2_list)
{
! struct neighbor_2_entry *two_hop_entry;
!
! two_hop_entry = two_hop_list->neighbor_2;
two_hop_entry->neighbor_2_pointer--;
--- 177,181 ----
while(two_hop_list != &entry->neighbor_2_list)
{
! struct neighbor_2_entry *two_hop_entry = two_hop_list->neighbor_2;
two_hop_entry->neighbor_2_pointer--;
***************
*** 224,228 ****
*/
struct neighbor_entry *
! olsr_insert_neighbor_table(union olsr_ip_addr *main_addr)
{
olsr_u32_t hash;
--- 220,224 ----
*/
struct neighbor_entry *
! olsr_insert_neighbor_table(const union olsr_ip_addr *main_addr)
{
olsr_u32_t hash;
***************
*** 274,306 ****
*/
struct neighbor_entry *
! olsr_lookup_neighbor_table(union olsr_ip_addr *dst)
{
- struct neighbor_entry *entry;
- olsr_u32_t hash;
- union olsr_ip_addr *tmp_ip;
-
/*
*Find main address of node
*/
! if((tmp_ip = mid_lookup_main_addr(dst)) != NULL)
dst = tmp_ip;
!
! hash = olsr_hashing(dst);
!
!
! //printf("\nLookup %s\n", olsr_ip_to_string(dst));
! for(entry = neighbortable[hash].next;
! entry != &neighbortable[hash];
! entry = entry->next)
! {
! //printf("Checking %s\n", olsr_ip_to_string(&neighbor_table_tmp->neighbor_main_addr));
! if(COMP_IP(&entry->neighbor_main_addr, dst))
! return entry;
!
! }
! //printf("NOPE\n\n");
!
! return NULL;
!
}
--- 270,282 ----
*/
struct neighbor_entry *
! olsr_lookup_neighbor_table(const union olsr_ip_addr *dst)
{
/*
*Find main address of node
*/
! union olsr_ip_addr *tmp_ip = mid_lookup_main_addr(dst);
! if(tmp_ip != NULL)
dst = tmp_ip;
! return olsr_lookup_neighbor_table_alias(dst);
}
***************
*** 315,325 ****
*/
struct neighbor_entry *
! olsr_lookup_neighbor_table_alias(union olsr_ip_addr *dst)
{
struct neighbor_entry *entry;
! olsr_u32_t hash;
!
! hash = olsr_hashing(dst);
!
//printf("\nLookup %s\n", olsr_ip_to_string(dst));
--- 291,298 ----
*/
struct neighbor_entry *
! olsr_lookup_neighbor_table_alias(const union olsr_ip_addr *dst)
{
struct neighbor_entry *entry;
! olsr_u32_t hash = olsr_hashing(dst);
//printf("\nLookup %s\n", olsr_ip_to_string(dst));
***************
*** 342,346 ****
int
! update_neighbor_status(struct neighbor_entry *entry, int link)
{
/*
--- 315,319 ----
int
! update_neighbor_status(struct neighbor_entry *entry, int lnk)
{
/*
***************
*** 348,352 ****
*/
! if(link == SYM_LINK)
{
/* N_status is set to SYM */
--- 321,325 ----
*/
! if(lnk == SYM_LINK)
{
/* N_status is set to SYM */
***************
*** 398,404 ****
olsr_time_out_two_hop_neighbors(struct neighbor_entry *neighbor)
{
! struct neighbor_2_list_entry *two_hop_list;
!
! two_hop_list = neighbor->neighbor_2_list.next;
while(two_hop_list != &neighbor->neighbor_2_list)
--- 371,375 ----
olsr_time_out_two_hop_neighbors(struct neighbor_entry *neighbor)
{
! struct neighbor_2_list_entry *two_hop_list = neighbor->neighbor_2_list.next;
while(two_hop_list != &neighbor->neighbor_2_list)
***************
*** 415,419 ****
{
DEQUEUE_ELEM(two_hop_entry);
! free((void *)two_hop_entry);
}
--- 386,390 ----
{
DEQUEUE_ELEM(two_hop_entry);
! free(two_hop_entry);
}
***************
*** 440,449 ****
olsr_time_out_neighborhood_tables(void)
{
! olsr_u8_t index;
! for(index=0;index<HASHSIZE;index++)
{
struct neighbor_entry *entry;
! for(entry = neighbortable[index].next; entry != &neighbortable[index]; entry = entry->next)
{
olsr_time_out_two_hop_neighbors(entry);
--- 411,420 ----
olsr_time_out_neighborhood_tables(void)
{
! int idx;
! for(idx=0;idx<HASHSIZE;idx++)
{
struct neighbor_entry *entry;
! for(entry = neighbortable[idx].next; entry != &neighbortable[idx]; entry = entry->next)
{
olsr_time_out_two_hop_neighbors(entry);
***************
*** 486,494 ****
for(neigh = neighbortable[i].next; neigh != &neighbortable[i]; neigh = neigh->next)
{
! struct link_entry *link = get_best_link_to_neighbor(&neigh->neighbor_main_addr);
! if(link)
{
! double best_lq = link->neigh_link_quality;
! double inv_best_lq = link->loss_link_quality;
OLSR_PRINTF(1, fstr, olsr_ip_to_string(&neigh->neighbor_main_addr),
--- 457,465 ----
for(neigh = neighbortable[i].next; neigh != &neighbortable[i]; neigh = neigh->next)
{
! struct link_entry *lnk = get_best_link_to_neighbor(&neigh->neighbor_main_addr);
! if(lnk)
{
! const double best_lq = lnk->neigh_link_quality;
! const double inv_best_lq = lnk->loss_link_quality;
OLSR_PRINTF(1, fstr, olsr_ip_to_string(&neigh->neighbor_main_addr),
***************
*** 502,513 ****
}
}
-
-
-
-
-
-
-
-
-
-
--- 473,474 ----
More information about the Olsr-cvs
mailing list