[Olsr-cvs] olsrd-current/src net_olsr.h, 1.4, 1.5 net_olsr.c, 1.15, 1.16
Bernd Petrovitsch
(spam-protected)
Wed Nov 15 22:13:54 CET 2006
Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8349/src
Modified Files:
net_olsr.h net_olsr.c
Log Message:
* Created a typedef for the packet-transfromation-function. It is easier
to parse (at least IMHO) than the "int (*)(char *, int *)" all over
the place.
* simplified the source in net_outbuffer_bytes_left() without changing
the semantics. Either this is correct or it should have been different
before.
* reduced duplicated code in del_ptf()
Index: net_olsr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** net_olsr.c 15 Nov 2006 20:58:51 -0000 1.15
--- net_olsr.c 15 Nov 2006 21:13:52 -0000 1.16
***************
*** 89,93 ****
struct ptf
{
! int (*function)(char *, int *);
struct ptf *next;
};
--- 89,93 ----
struct ptf
{
! packet_transform_function function;
struct ptf *next;
};
***************
*** 350,361 ****
net_outbuffer_bytes_left(struct interface *ifp)
{
- int remaining;
-
if(!netbufs[ifp->if_nr])
return 0;
! remaining = netbufs[ifp->if_nr]->maxsize - netbufs[ifp->if_nr]->pending;
!
! return remaining ? remaining : 0;
}
--- 350,357 ----
net_outbuffer_bytes_left(struct interface *ifp)
{
if(!netbufs[ifp->if_nr])
return 0;
! return netbufs[ifp->if_nr]->maxsize - netbufs[ifp->if_nr]->pending;
}
***************
*** 370,374 ****
*/
int
! add_ptf(int (*f)(char *, int *))
{
--- 366,370 ----
*/
int
! add_ptf(packet_transform_function f)
{
***************
*** 394,398 ****
*/
int
! del_ptf(int (*f)(char *, int *))
{
struct ptf *tmp_ptf, *prev;
--- 390,394 ----
*/
int
! del_ptf(packet_transform_function f)
{
struct ptf *tmp_ptf, *prev;
***************
*** 407,419 ****
/* Remove entry */
if(prev == NULL)
- {
ptf_list = tmp_ptf->next;
- free(tmp_ptf);
- }
else
- {
prev->next = tmp_ptf->next;
! free(tmp_ptf);
! }
return 1;
}
--- 403,410 ----
/* Remove entry */
if(prev == NULL)
ptf_list = tmp_ptf->next;
else
prev->next = tmp_ptf->next;
! free(tmp_ptf);
return 1;
}
Index: net_olsr.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** net_olsr.h 15 Nov 2006 20:58:51 -0000 1.4
--- net_olsr.h 15 Nov 2006 21:13:52 -0000 1.5
***************
*** 50,53 ****
--- 50,55 ----
#include <net/if.h>
+ typedef int (*packet_transform_function)(char *, int *);
+
#ifdef USE_LIBNET
char *
***************
*** 107,114 ****
int
! add_ptf(int (*)(char *, int *));
int
! del_ptf(int (*f)(char *, int *));
olsr_bool
--- 109,116 ----
int
! add_ptf(packet_transform_function);
int
! del_ptf(packet_transform_function);
olsr_bool
More information about the Olsr-cvs
mailing list