Skip to content

Commit

Permalink
netdev2: function parameter type changes
Browse files Browse the repository at this point in the history
`len` and `count` are both values that should never go `< 0`, so instead of
having to test this (in theory) every time the function is called (regardless
of by assert or if its unnecessary code), I propose to change it to `size_t`.

As a bonus I made the type of recv's buf parameter generic - no reason for it to
be a char and it might lead to unnecessary static casting requirements
  • Loading branch information
miri64 committed Aug 3, 2016
1 parent 25e8146 commit e710164
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/include/net/netdev2.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ typedef struct netdev2_driver {
*
* @return nr of bytes sent, or <=0 on error
*/
int (*send)(netdev2_t *dev, const struct iovec *vector, int count);
int (*send)(netdev2_t *dev, const struct iovec *vector, unsigned count);

/**
* @brief Get a received frame
Expand All @@ -158,7 +158,7 @@ typedef struct netdev2_driver {
* @return nr of bytes read if buf != NULL
* @return packet size if buf == NULL
*/
int (*recv)(netdev2_t *dev, char *buf, int len, void *info);
int (*recv)(netdev2_t *dev, void *buf, size_t len, void *info);

/**
* @brief the driver's initialization function
Expand Down

0 comments on commit e710164

Please sign in to comment.