[Olsr-cvs] olsrd-current/lib/pgraph/src olsrd_pgraph.c, 1.3, 1.4 olsrd_pgraph.h, 1.1, 1.2 olsrd_plugin.c, 1.1, 1.2

Bernd Petrovitsch (spam-protected)
Fri Apr 20 15:46:05 CEST 2007


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

Modified Files:
	olsrd_pgraph.c olsrd_pgraph.h olsrd_plugin.c 
Log Message:
cleanup, 1. step (to get some local changes away):
* killed lots of warnings
* added __attribure__((unused)) and __attribure__((format(printf, ..., ...)))
* added "const"
* moved declarations of static functions into .c files
* added "static" declarations
* removed all "inline" declarations. Usually the compiler knows better anyways.
* removed emtpy "return" statements at the end of functions
* localized declarations
* avoided unnecessary data copies
* removed lots of empty lines
There is much more to do.



Index: olsrd_pgraph.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_pgraph.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** olsrd_pgraph.h	13 Jul 2005 21:45:08 -0000	1.1
--- olsrd_pgraph.h	20 Apr 2007 13:46:03 -0000	1.2
***************
*** 74,78 ****
  extern int ipc_port;
  
! char netmask[5];
  
  /* Event function to register with the sceduler */
--- 74,78 ----
  extern int ipc_port;
  
! extern char netmask[5];
  
  /* Event function to register with the sceduler */
***************
*** 83,98 ****
  ipc_action(int);
  
- static void inline
- ipc_print_neigh_link(struct neighbor_entry *neighbor);
- 
- static void inline
- ipc_print_tc_link(struct tc_entry *entry, struct topo_dst *dst_entry);
- 
- static void inline
- ipc_print_net(union olsr_ip_addr *, union olsr_ip_addr *, union hna_netmask *);
- 
- int
- ipc_send(char *, int);
- 
  char *
  olsr_netmask_to_string(union hna_netmask *);
--- 83,86 ----

Index: olsrd_pgraph.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_pgraph.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** olsrd_pgraph.c	7 Jan 2006 08:17:43 -0000	1.3
--- olsrd_pgraph.c	20 Apr 2007 13:46:02 -0000	1.4
***************
*** 62,69 ****
  int ipc_socket_up;
  
! static void inline
  ipc_print_neigh_link(struct neighbor_entry *);
  
! int
  plugin_ipc_init(void);
  
--- 62,83 ----
  int ipc_socket_up;
  
! static void
! ipc_print_neigh_link(struct neighbor_entry *neighbor);
! 
! static void
! ipc_print_tc_link(struct tc_entry *entry, struct topo_dst *dst_entry);
! 
! #if 0
! static void
! ipc_print_net(union olsr_ip_addr *, union olsr_ip_addr *, union hna_netmask *);
! #endif
! 
! static int
! ipc_send(const char *, int);
! 
! static void
  ipc_print_neigh_link(struct neighbor_entry *);
  
! static int
  plugin_ipc_init(void);
  
***************
*** 72,82 ****
  
  
! static void inline
  ipc_print_neigh_link(struct neighbor_entry *neighbor)
  {
    char buf[256];
    int len;
!   char* main_adr;
!   char* adr;
  //  double etx=0.0;
  //  char* style = "solid";
--- 86,96 ----
  
  
! static void
  ipc_print_neigh_link(struct neighbor_entry *neighbor)
  {
    char buf[256];
    int len;
!   const char* main_adr;
!   const char* adr;
  //  double etx=0.0;
  //  char* style = "solid";
***************
*** 121,125 ****
   */
  int
! olsrd_plugin_init()
  {
  
--- 135,139 ----
   */
  int
! olsrd_plugin_init(void)
  {
  
***************
*** 135,139 ****
  
  int
! plugin_ipc_init()
  {
    struct sockaddr_in sin;
--- 149,153 ----
  
  int
! plugin_ipc_init(void)
  {
    struct sockaddr_in sin;
***************
*** 194,198 ****
  
  void
! ipc_action(int fd)
  {
    struct sockaddr_in pin;
--- 208,212 ----
  
  void
! ipc_action(int fd __attribute__((unused)))
  {
    struct sockaddr_in pin;
***************
*** 236,240 ****
   */
  void
! olsr_plugin_exit()
  {
    if(ipc_open)
--- 250,254 ----
   */
  void
! olsr_plugin_exit(void)
  {
    if(ipc_open)
***************
*** 250,254 ****
  pcf_event(int changes_neighborhood,
  	  int changes_topology,
! 	  int changes_hna)
  {
    int res;
--- 264,268 ----
  pcf_event(int changes_neighborhood,
  	  int changes_topology,
! 	  int changes_hna __attribute__((unused)))
  {
    int res;
***************
*** 345,355 ****
  #endif
  
! static void inline
  ipc_print_tc_link(struct tc_entry *entry, struct topo_dst *dst_entry)
  {
    char buf[256];
    int len;
!   char* main_adr;
!   char* adr;
  //  double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality );
  
--- 359,369 ----
  #endif
  
! static void
  ipc_print_tc_link(struct tc_entry *entry, struct topo_dst *dst_entry)
  {
    char buf[256];
    int len;
!   const char* main_adr;
!   const char* adr;
  //  double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality );
  
***************
*** 360,367 ****
  }
  
! static void inline
  ipc_print_net(union olsr_ip_addr *gw, union olsr_ip_addr *net, union hna_netmask *mask)
  {
!   char *adr;
  
    adr = olsr_ip_to_string(gw);
--- 374,382 ----
  }
  
! #if 0
! static void
  ipc_print_net(union olsr_ip_addr *gw, union olsr_ip_addr *net, union hna_netmask *mask)
  {
!   const char *adr;
  
    adr = olsr_ip_to_string(gw);
***************
*** 384,392 ****
    ipc_send("[shape=diamond];\n", strlen("[shape=diamond];\n"));
  }
! 
  
  
  int
! ipc_send(char *data, int size)
  {
    if(!ipc_open)
--- 399,407 ----
    ipc_send("[shape=diamond];\n", strlen("[shape=diamond];\n"));
  }
! #endif
  
  
  int
! ipc_send(const char *data, int size)
  {
    if(!ipc_open)

Index: olsrd_plugin.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_plugin.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** olsrd_plugin.c	13 Jul 2005 21:45:08 -0000	1.1
--- olsrd_plugin.c	20 Apr 2007 13:46:03 -0000	1.2
***************
*** 79,83 ****
   */
  int 
! olsrd_plugin_interface_version()
  {
    return PLUGIN_INTERFACE_VERSION;
--- 79,83 ----
   */
  int 
! olsrd_plugin_interface_version(void)
  {
    return PLUGIN_INTERFACE_VERSION;
***************
*** 89,93 ****
   */
  void
! my_init()
  {
    /* Print plugin info to stdout */
--- 89,93 ----
   */
  void
! my_init(void)
  {
    /* Print plugin info to stdout */
***************
*** 105,109 ****
   */
  void
! my_fini()
  {
  
--- 105,109 ----
   */
  void
! my_fini(void)
  {
  





More information about the Olsr-cvs mailing list