Re: [PATCH 2/2] Clean up some more function-scope-static abuse
Eric Anholt <[email protected]>
| Newsgroups | gmane.comp.freedesktop.xcb |
|---|---|
| Message-ID | <[email protected]> |
Adam Jackson <[email protected]> writes: > Signed-off-by: Adam Jackson <[email protected]> > --- > src/xcb_conn.c | 2 +- > src/xcb_out.c | 4 ++-- > src/xcb_util.c | 4 ++-- > 3 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/src/xcb_conn.c b/src/xcb_conn.c > index 7d09637..6632d90 100644 > --- a/src/xcb_conn.c > +++ b/src/xcb_conn.c > @@ -125,7 +125,7 @@ static int set_fd_flags(const int fd) > > static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info) > { > - static const char pad[3]; > + const char pad[3]; > xcb_setup_request_t out; > struct iovec parts[6]; > int count = 0; Isn't this taking pad from being implicitly zeroed to being stack garbage? I think you'd need " = { 0 }" > diff --git a/src/xcb_out.c b/src/xcb_out.c > index 3601a5f..dc51ae0 100644 > --- a/src/xcb_out.c > +++ b/src/xcb_out.c > @@ -70,7 +70,7 @@ static inline void send_request(xcb_connection_t *c, int isvoid, enum workaround > > static void send_sync(xcb_connection_t *c) > { > - static const union { > + const union { > struct { > uint8_t major; > uint8_t pad; Definitely a good one. This union should compile to an immediate constant in the code. > @@ -237,7 +237,7 @@ uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iove > > if(!(flags & XCB_REQUEST_RAW)) > { > - static const char pad[3]; > + const char pad[3]; > unsigned int i; > uint16_t shortlen = 0; > size_t longlen = 0; Same stack concern. > diff --git a/src/xcb_util.c b/src/xcb_util.c > index a3357ef..d5605da 100644 > --- a/src/xcb_util.c > +++ b/src/xcb_util.c > @@ -227,9 +227,9 @@ static int _xcb_open(const char *host, char *protocol, const int display) > { > int fd; > #ifdef __hpux > - static const char unix_base[] = "/usr/spool/sockets/X11/"; > + const char unix_base[] = "/usr/spool/sockets/X11/"; > #else > - static const char unix_base[] = "/tmp/.X11-unix/X"; > + const char unix_base[] = "/tmp/.X11-unix/X"; > #endif Also good. _______________________________________________ Xcb mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/xcb
signature.asc
(application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAllT49EACgkQtdYpNtH8 nuhpFQ/+P9y+70+6PGhMwYukHzNfYw1taGbbeqzxWJ5I5zZejWJjfEqVxnE6OfkX GpBrfyObDgn2L3d1c/NzT+HgALc/XAe+dyfA1zS99U/UhmHmreOtbElPTPQsGRmQ OrN5R56lsZvuTO+WqH0Rj5B3c/nnq5ml4mgj248dADTo4NQusFxQq/ilNt2GZ+Of ZrSRZz3s4LZeazY6OlCIjRnfAkt/O86KWpxHqTLyQUhEKfOiI9W0LN8esnogopnp TINwAYLjKdUIZDdjlI/VWokRx9jgn+8O1bGN2s+TKtM+UKh7c/H+qDvmJ4BVFKFe mih8Im2GbMI1NciihfMR9WNU3DI2HxR8Dl1RQd+VodRbahENzdzIKtKwIFMBMobf fLFC3bZhfdGi2iGzjzsIpnUuvkwh+iYl/VDo+VeakiXEsz3tFYHO0WqO1G2QECEk dII/t2YAiXWfjLsaP70Oja2yE88g7+Lpxbv+Hc+E75L8T0AGuXIWHnrqUdY3nJ+w a9NmW4/Wf5zDb2Xfr38jvb9xHjfuCq/s8FZn3PS1oKNyd3hOJLFCTmAx85UxL19L ZwQItas0z6dHgwV2Nyi3yE2bEIh5/Nkwjpn1yp9lw5GxRqM2W3k0K98JcofqEUKN Dytqur0CFF/1ZxMUL/y6u/SLKqPkmmlNSFyyHTAWLSKAfzlq2VA= =BiUs -----END PGP SIGNATURE-----