All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] util: surround MAC_STR array access with ()
@ 2021-09-27 22:41 James Prestwood
  0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2021-09-27 22:41 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

This allows printing from pointer offsets, for example:

MAC_STR(buf + 10)
---
 src/util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util.h b/src/util.h
index ae640698..23353ddb 100644
--- a/src/util.h
+++ b/src/util.h
@@ -29,7 +29,7 @@
 #define align_len(len, boundary) (((len)+(boundary)-1) & ~((boundary)-1))
 
 #define MAC "%02x:%02x:%02x:%02x:%02x:%02x"
-#define MAC_STR(a) a[0], a[1], a[2], a[3], a[4], a[5]
+#define MAC_STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
 
 const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid);
 bool util_ssid_is_utf8(size_t len, const uint8_t *ssid);
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/3] util: surround MAC_STR array access with ()
@ 2021-09-28  0:34 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-09-28  0:34 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]

Hi James,

On 9/27/21 5:41 PM, James Prestwood wrote:
> This allows printing from pointer offsets, for example:
> 
> MAC_STR(buf + 10)
> ---
>   src/util.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

All applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-28  0:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 22:41 [PATCH 1/3] util: surround MAC_STR array access with () James Prestwood
2021-09-28  0:34 Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.