mirror of https://gitee.com/openkylin/linux.git
Staging: wlan-ng: Move wlan_mkprintstr() and wlan_hexchar() macros into prism2sta.c
Signed-off-by: Moritz Muehlenhoff <jmm@debian.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
96c5abd7f8
commit
16910554f3
|
@ -90,14 +90,31 @@
|
||||||
#include "hfa384x.h"
|
#include "hfa384x.h"
|
||||||
#include "prism2mgmt.h"
|
#include "prism2mgmt.h"
|
||||||
|
|
||||||
/*================================================================*/
|
|
||||||
/* Local Constants */
|
|
||||||
|
|
||||||
/*================================================================*/
|
/*================================================================*/
|
||||||
/* Local Macros */
|
/* Local Macros */
|
||||||
|
|
||||||
/*================================================================*/
|
#define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
|
||||||
/* Local Types */
|
|
||||||
|
/* Create a string of printable chars from something that might not be */
|
||||||
|
/* It's recommended that the str be 4*len + 1 bytes long */
|
||||||
|
#define wlan_mkprintstr(buf, buflen, str, strlen) \
|
||||||
|
{ \
|
||||||
|
int i = 0; \
|
||||||
|
int j = 0; \
|
||||||
|
memset(str, 0, (strlen)); \
|
||||||
|
for (i = 0; i < (buflen); i++) { \
|
||||||
|
if ( isprint((buf)[i]) ) { \
|
||||||
|
(str)[j] = (buf)[i]; \
|
||||||
|
j++; \
|
||||||
|
} else { \
|
||||||
|
(str)[j] = '\\'; \
|
||||||
|
(str)[j+1] = 'x'; \
|
||||||
|
(str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
|
||||||
|
(str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
|
||||||
|
j += 4; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/*================================================================*/
|
/*================================================================*/
|
||||||
/* Local Static Definitions */
|
/* Local Static Definitions */
|
||||||
|
|
|
@ -60,33 +60,6 @@
|
||||||
|
|
||||||
#define WLAN_LOG_DEBUG(l, s, args...)
|
#define WLAN_LOG_DEBUG(l, s, args...)
|
||||||
|
|
||||||
/*=============================================================*/
|
|
||||||
/*--- General Macros ------------------------------------------*/
|
|
||||||
/*=============================================================*/
|
|
||||||
|
|
||||||
#define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
|
|
||||||
|
|
||||||
/* Create a string of printable chars from something that might not be */
|
|
||||||
/* It's recommended that the str be 4*len + 1 bytes long */
|
|
||||||
#define wlan_mkprintstr(buf, buflen, str, strlen) \
|
|
||||||
{ \
|
|
||||||
int i = 0; \
|
|
||||||
int j = 0; \
|
|
||||||
memset(str, 0, (strlen)); \
|
|
||||||
for (i = 0; i < (buflen); i++) { \
|
|
||||||
if ( isprint((buf)[i]) ) { \
|
|
||||||
(str)[j] = (buf)[i]; \
|
|
||||||
j++; \
|
|
||||||
} else { \
|
|
||||||
(str)[j] = '\\'; \
|
|
||||||
(str)[j+1] = 'x'; \
|
|
||||||
(str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
|
|
||||||
(str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
|
|
||||||
j += 4; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*=============================================================*/
|
/*=============================================================*/
|
||||||
/*--- Variables -----------------------------------------------*/
|
/*--- Variables -----------------------------------------------*/
|
||||||
/*=============================================================*/
|
/*=============================================================*/
|
||||||
|
|
Loading…
Reference in New Issue