[Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.20, 1.21 olsrd_plugin.c, 1.11, 1.12

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


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

Modified Files:
	nameservice.c 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: nameservice.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** nameservice.c	20 Apr 2007 10:33:08 -0000	1.20
--- nameservice.c	20 Apr 2007 13:46:02 -0000	1.21
***************
*** 105,109 ****
   */
  void
! name_constructor() 
  {
  	int i;
--- 105,109 ----
   */
  void
! name_constructor(void) 
  {
  	int i;
***************
*** 258,262 ****
   */
  int
! name_init()
  {
  	struct name_entry *name;
--- 258,262 ----
   */
  int
! name_init(void)
  {
  	struct name_entry *name;
***************
*** 391,395 ****
   */
  void
! name_destructor()
  {
  	olsr_printf(2, "NAME PLUGIN: exit. cleaning up...\n");
--- 391,395 ----
   */
  void
! name_destructor(void)
  {
  	olsr_printf(2, "NAME PLUGIN: exit. cleaning up...\n");
***************
*** 413,425 ****
  {
  	int i;
- 	struct db_entry **tmp;
- 	struct db_entry *to_delete;
  	
  	for(i = 0; i < HASHSIZE; i++)
  	{
! 		tmp = &list[i];
  		while(*tmp != NULL)
  		{
! 			to_delete = *tmp;
  			*tmp = (*tmp)->next;
  			free_name_entry_list(&to_delete->names);
--- 413,423 ----
  {
  	int i;
  	
  	for(i = 0; i < HASHSIZE; i++)
  	{
!         struct db_entry **tmp = &this_db_list[i];
  		while(*tmp != NULL)
  		{
!             struct db_entry *to_delete = *tmp;
  			*tmp = (*tmp)->next;
  			free_name_entry_list(&to_delete->names);
***************
*** 441,445 ****
   */
  void
! olsr_timeout()
  {
      timeout_old_names(list, &name_table_changed);
--- 439,443 ----
   */
  void
! olsr_timeout(void)
  {
      timeout_old_names(list, &name_table_changed);
***************
*** 489,493 ****
   */
  void
! olsr_event(void *foo)
  {
  	union olsr_message *message = (union olsr_message*)buffer;
--- 487,491 ----
   */
  void
! olsr_event(void *foo __attribute__((unused)))
  {
  	union olsr_message *message = (union olsr_message*)buffer;
***************
*** 834,838 ****
   */
  void
! write_hosts_file()
  {
  	int hash;
--- 832,836 ----
   */
  void
! write_hosts_file(void)
  {
  	int hash;
***************
*** 915,919 ****
   */
  void
! write_services_file()
  {
  	int hash;
--- 913,917 ----
   */
  void
! write_services_file(void)
  {
  	int hash;
***************
*** 973,977 ****
   */
  void
! write_resolv_file()
  {
  	int hash;
--- 971,975 ----
   */
  void
! write_resolv_file(void)
  {
  	int hash;

Index: olsrd_plugin.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/olsrd_plugin.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** olsrd_plugin.c	29 May 2005 12:47:42 -0000	1.11
--- olsrd_plugin.c	20 Apr 2007 13:46:02 -0000	1.12
***************
*** 42,46 ****
  #include "nameservice.h"
  
- 
  #define PLUGIN_NAME    "OLSRD nameservice plugin"
  #define PLUGIN_VERSION "0.2"
--- 42,45 ----
***************
*** 55,67 ****
  my_fini(void);
  
- 
  int 
! olsrd_plugin_interface_version()
  {
  	return OLSRD_PLUGIN_INTERFACE_VERSION;
  }
  
! 
! int olsrd_plugin_init()
  {
  	return name_init();
--- 54,65 ----
  my_fini(void);
  
  int 
! olsrd_plugin_interface_version(void)
  {
  	return OLSRD_PLUGIN_INTERFACE_VERSION;
  }
  
! int
! olsrd_plugin_init(void)
  {
  	return name_init();
***************
*** 70,74 ****
  
  static void
! my_init()
  {
  	/* Print plugin info to stdout */
--- 68,72 ----
  
  static void
! my_init(void)
  {
  	/* Print plugin info to stdout */
***************
*** 82,86 ****
  
  static void
! my_fini()
  {
  	name_destructor();
--- 80,84 ----
  
  static void
! my_fini(void)
  {
  	name_destructor();





More information about the Olsr-cvs mailing list