mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 21:51:40 +00:00
net: fddi: use swap() to make code cleaner
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid opencoding it. Signed-off-by: Yihao Han <hanyihao@vivo.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9ed941178c
commit
311107bdec
@ -1846,10 +1846,10 @@ void smt_swap_para(struct smt_header *sm, int len, int direction)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void smt_string_swap(char *data, const char *format, int len)
|
||||
{
|
||||
const char *open_paren = NULL ;
|
||||
int x ;
|
||||
|
||||
while (len > 0 && *format) {
|
||||
switch (*format) {
|
||||
@ -1876,19 +1876,13 @@ static void smt_string_swap(char *data, const char *format, int len)
|
||||
len-- ;
|
||||
break ;
|
||||
case 's' :
|
||||
x = data[0] ;
|
||||
data[0] = data[1] ;
|
||||
data[1] = x ;
|
||||
swap(data[0], data[1]) ;
|
||||
data += 2 ;
|
||||
len -= 2 ;
|
||||
break ;
|
||||
case 'l' :
|
||||
x = data[0] ;
|
||||
data[0] = data[3] ;
|
||||
data[3] = x ;
|
||||
x = data[1] ;
|
||||
data[1] = data[2] ;
|
||||
data[2] = x ;
|
||||
swap(data[0], data[3]) ;
|
||||
swap(data[1], data[2]) ;
|
||||
data += 4 ;
|
||||
len -= 4 ;
|
||||
break ;
|
||||
|
Loading…
Reference in New Issue
Block a user