[Olsr-cvs] olsrd-current/src mid_set.c, 1.20, 1.21 mid_set.h, 1.14, 1.15

Bernd Petrovitsch (spam-protected)
Thu Aug 2 23:50:24 CEST 2007


Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30980/src

Modified Files:
	mid_set.c mid_set.h 
Log Message:
* const-ify parameters
* pave the way to add -Wshadow
* use "NULL" instead for "0" for pointers


Index: mid_set.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** mid_set.h	10 Feb 2007 19:27:32 -0000	1.14
--- mid_set.h	2 Aug 2007 21:50:22 -0000	1.15
***************
*** 46,49 ****
--- 46,50 ----
  #include "olsr_types.h"
  
+ 
  struct mid_address
  {
***************
*** 80,93 ****
  
  void 
! insert_mid_tuple(union olsr_ip_addr *, struct mid_address *, float);
  
  void
! insert_mid_alias(union olsr_ip_addr *, union olsr_ip_addr *, float);
  
  union olsr_ip_addr *
! mid_lookup_main_addr(union olsr_ip_addr *);
  
  struct mid_address *
! mid_lookup_aliases(union olsr_ip_addr *);
  
  void
--- 81,94 ----
  
  void 
! insert_mid_tuple(const union olsr_ip_addr *, struct mid_address *, float);
  
  void
! insert_mid_alias(const union olsr_ip_addr *, const union olsr_ip_addr *, float);
  
  union olsr_ip_addr *
! mid_lookup_main_addr(const union olsr_ip_addr *);
  
  struct mid_address *
! mid_lookup_aliases(const union olsr_ip_addr *);
  
  void
***************
*** 98,105 ****
  
  void
! olsr_prune_aliases(union olsr_ip_addr *m_addr, struct mid_alias *declared_aliases);
  
  int
! olsr_update_mid_table(union olsr_ip_addr *, float);
  
  int
--- 99,106 ----
  
  void
! olsr_prune_aliases(const union olsr_ip_addr *m_addr, struct mid_alias *declared_aliases);
  
  int
! olsr_update_mid_table(const union olsr_ip_addr *, float);
  
  int

Index: mid_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** mid_set.c	25 Apr 2007 22:08:09 -0000	1.20
--- mid_set.c	2 Aug 2007 21:50:22 -0000	1.21
***************
*** 53,57 ****
  struct mid_address reverse_mid_set[HASHSIZE];
  
! struct mid_entry *mid_lookup_entry_bymain(union olsr_ip_addr *adr);
  
  /**
--- 53,57 ----
  struct mid_address reverse_mid_set[HASHSIZE];
  
! struct mid_entry *mid_lookup_entry_bymain(const union olsr_ip_addr *adr);
  
  /**
***************
*** 63,67 ****
  olsr_init_mid_set(void)
  {
!   int index;
  
    OLSR_PRINTF(5, "MID: init\n");
--- 63,67 ----
  olsr_init_mid_set(void)
  {
!   int idx;
  
    OLSR_PRINTF(5, "MID: init\n");
***************
*** 72,82 ****
    olsr_register_scheduler_event(&olsr_time_out_mid_set, NULL, 1, 0, NULL);
  
!   for(index=0;index<HASHSIZE;index++)
      {
!       mid_set[index].next = &mid_set[index];
!       mid_set[index].prev = &mid_set[index];
  
!       reverse_mid_set[index].next = &reverse_mid_set[index];
!       reverse_mid_set[index].prev = &reverse_mid_set[index];
      }
  
--- 72,82 ----
    olsr_register_scheduler_event(&olsr_time_out_mid_set, NULL, 1, 0, NULL);
  
!   for(idx=0;idx<HASHSIZE;idx++)
      {
!       mid_set[idx].next = &mid_set[idx];
!       mid_set[idx].prev = &mid_set[idx];
  
!       reverse_mid_set[idx].next = &reverse_mid_set[idx];
!       reverse_mid_set[idx].prev = &reverse_mid_set[idx];
      }
  
***************
*** 97,101 ****
  
  void 
! insert_mid_tuple(union olsr_ip_addr *m_addr, struct mid_address *alias, float vtime)
  {
    struct mid_entry *tmp;
--- 97,101 ----
  
  void 
! insert_mid_tuple(const union olsr_ip_addr *m_addr, struct mid_address *alias, float vtime)
  {
    struct mid_entry *tmp;
***************
*** 134,140 ****
        tmp->ass_timer = GET_TIMESTAMP(vtime*1000);
      }
-       /*Create new node*/
    else
      {
        tmp = olsr_malloc(sizeof(struct mid_entry), "MID new alias");
  
--- 134,140 ----
        tmp->ass_timer = GET_TIMESTAMP(vtime*1000);
      }
    else
      {
+       /*Create new node*/
        tmp = olsr_malloc(sizeof(struct mid_entry), "MID new alias");
  
***************
*** 213,217 ****
   */
  void
! insert_mid_alias(union olsr_ip_addr *main_add, union olsr_ip_addr *alias, float vtime)
  {
    struct mid_address *adr;
--- 213,217 ----
   */
  void
! insert_mid_alias(const union olsr_ip_addr *main_add, const union olsr_ip_addr *alias, float vtime)
  {
    struct mid_address *adr;
***************
*** 261,267 ****
  }
  
- 
- 
- 
  /**
   *Lookup the main address for a alias address
--- 261,264 ----
***************
*** 273,277 ****
   */
  union olsr_ip_addr *
! mid_lookup_main_addr(union olsr_ip_addr *adr)
  {
    olsr_u32_t hash;
--- 270,274 ----
   */
  union olsr_ip_addr *
! mid_lookup_main_addr(const union olsr_ip_addr *adr)
  {
    olsr_u32_t hash;
***************
*** 291,295 ****
  }
  
- 
  /* Find mid entry to an address.
   * @param adr the main address to search for
--- 288,291 ----
***************
*** 298,302 ****
   */
  struct mid_entry *
! mid_lookup_entry_bymain(union olsr_ip_addr *adr)
  {
    struct mid_entry *tmp_list;
--- 294,298 ----
   */
  struct mid_entry *
! mid_lookup_entry_bymain(const union olsr_ip_addr *adr)
  {
    struct mid_entry *tmp_list;
***************
*** 315,324 ****
  	return tmp_list;
      }
- 
- 
    return NULL;
  }
  
- 
  /*
   *Find all aliases for an address.
--- 311,317 ----
***************
*** 329,333 ****
   */
  struct mid_address *
! mid_lookup_aliases(union olsr_ip_addr *adr)
  {
    struct mid_entry *tmp = mid_lookup_entry_bymain(adr);
--- 322,326 ----
   */
  struct mid_address *
! mid_lookup_aliases(const union olsr_ip_addr *adr)
  {
    struct mid_entry *tmp = mid_lookup_entry_bymain(adr);
***************
*** 344,348 ****
   */
  int
! olsr_update_mid_table(union olsr_ip_addr *adr, float vtime)
  {
    struct mid_entry *tmp_list = mid_set;
--- 337,341 ----
   */
  int
! olsr_update_mid_table(const union olsr_ip_addr *adr, float vtime)
  {
    struct mid_entry *tmp_list = mid_set;
***************
*** 379,383 ****
   */
  void
! olsr_prune_aliases(union olsr_ip_addr *m_addr, struct mid_alias *declared_aliases)
  {
    struct mid_entry *entry;
--- 372,376 ----
   */
  void
! olsr_prune_aliases(const union olsr_ip_addr *m_addr, struct mid_alias *declared_aliases)
  {
    struct mid_entry *entry;
***************
*** 406,410 ****
    previous_alias = NULL;
  
!   while(registered_aliases != 0)
      {
        struct mid_address *current_alias = registered_aliases;
--- 399,403 ----
    previous_alias = NULL;
  
!   while(registered_aliases != NULL)
      {
        struct mid_address *current_alias = registered_aliases;
***************
*** 420,424 ****
          }
  
!       if (declared_aliases == 0)
          {
            /* Current alias not found in list of declared aliases: free current alias */
--- 413,417 ----
          }
  
!       if (declared_aliases == NULL)
          {
            /* Current alias not found in list of declared aliases: free current alias */
***************
*** 464,475 ****
  olsr_time_out_mid_set(void *foo __attribute__((unused)))
  {
!   int index;
! 
  
!   for(index=0;index<HASHSIZE;index++)
      {
!       struct mid_entry *tmp_list = mid_set[index].next;
        /*Traverse MID list*/
!       while(tmp_list != &mid_set[index])
  	{
  	  /*Check if the entry is timed out*/
--- 457,467 ----
  olsr_time_out_mid_set(void *foo __attribute__((unused)))
  {
!   int idx;
  
!   for(idx=0;idx<HASHSIZE;idx++)
      {
!       struct mid_entry *tmp_list = mid_set[idx].next;
        /*Traverse MID list*/
!       while(tmp_list != &mid_set[idx])
  	{
  	  /*Check if the entry is timed out*/
***************
*** 530,542 ****
  olsr_print_mid_set(void)
  {
!   int index;
  
    OLSR_PRINTF(1, "mid set: %02d:%02d:%02d.%06lu\n",nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec, now.tv_usec);
  
!   for(index=0;index<HASHSIZE;index++)
      {
!       struct mid_entry *tmp_list = mid_set[index].next;
        /*Traverse MID list*/
!       for(tmp_list = mid_set[index].next; tmp_list != &mid_set[index]; tmp_list = tmp_list->next)
  	{
  	  struct mid_address *tmp_addr;
--- 522,534 ----
  olsr_print_mid_set(void)
  {
!   int idx;
  
    OLSR_PRINTF(1, "mid set: %02d:%02d:%02d.%06lu\n",nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec, now.tv_usec);
  
!   for(idx=0;idx<HASHSIZE;idx++)
      {
!       struct mid_entry *tmp_list = mid_set[idx].next;
        /*Traverse MID list*/
!       for(tmp_list = mid_set[idx].next; tmp_list != &mid_set[idx]; tmp_list = tmp_list->next)
  	{
  	  struct mid_address *tmp_addr;





More information about the Olsr-cvs mailing list