Commit 311107bd authored by Yihao Han's avatar Yihao Han Committed by David S. Miller

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: default avatarYihao Han <hanyihao@vivo.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9ed94117
...@@ -1846,10 +1846,10 @@ void smt_swap_para(struct smt_header *sm, int len, int direction) ...@@ -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) static void smt_string_swap(char *data, const char *format, int len)
{ {
const char *open_paren = NULL ; const char *open_paren = NULL ;
int x ;
while (len > 0 && *format) { while (len > 0 && *format) {
switch (*format) { switch (*format) {
...@@ -1876,19 +1876,13 @@ static void smt_string_swap(char *data, const char *format, int len) ...@@ -1876,19 +1876,13 @@ static void smt_string_swap(char *data, const char *format, int len)
len-- ; len-- ;
break ; break ;
case 's' : case 's' :
x = data[0] ; swap(data[0], data[1]) ;
data[0] = data[1] ;
data[1] = x ;
data += 2 ; data += 2 ;
len -= 2 ; len -= 2 ;
break ; break ;
case 'l' : case 'l' :
x = data[0] ; swap(data[0], data[3]) ;
data[0] = data[3] ; swap(data[1], data[2]) ;
data[3] = x ;
x = data[1] ;
data[1] = data[2] ;
data[2] = x ;
data += 4 ; data += 4 ;
len -= 4 ; len -= 4 ;
break ; break ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment