diff options
author | Nick Lewycky <nlewycky@google.com> | 2015-04-16 11:15:58 -0700 |
---|---|---|
committer | Nick Lewycky <nlewycky@google.com> | 2015-04-16 11:15:58 -0700 |
commit | e19fc0ea57ac535c6aa28b58655cfcabfcf738d8 (patch) | |
tree | d24c5412de4de65e61d24c1ee0578f40d96a040f /socket/sys/un.h | |
parent | 2963bd873faf3eb3be33cca3a2ef3401ec088962 (diff) | |
download | glibc-e19fc0ea57ac535c6aa28b58655cfcabfcf738d8.tar.gz glibc-e19fc0ea57ac535c6aa28b58655cfcabfcf738d8.tar.xz glibc-e19fc0ea57ac535c6aa28b58655cfcabfcf738d8.zip |
Change this offsetof computation to use c89 offsetof. Tested:
Diffstat (limited to 'socket/sys/un.h')
-rw-r--r-- | socket/sys/un.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/socket/sys/un.h b/socket/sys/un.h index fc0ed39cd8..fdb6f944d4 100644 --- a/socket/sys/un.h +++ b/socket/sys/un.h @@ -34,10 +34,11 @@ struct sockaddr_un #ifdef __USE_MISC +# include <stddef.h> /* For offsetof. */ # include <string.h> /* For prototype of `strlen'. */ /* Evaluate to actual length of the `sockaddr_un' structure. */ -# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ +# define SUN_LEN(ptr) (offsetof(struct sockaddr_un, sun_path) \ + strlen ((ptr)->sun_path)) #endif |