Add _REENT_INIT_PTR_ZEROED()
Provide a _REENT_INIT_PTR_ZEROED() macro to initialize an already zero-initialized struct _reent. * libc/include/sys/reent.h (_REENT_INIT_PTR_ZEROED): New. (_REENT_INIT_PTR): Define only once and use _REENT_INIT_PTR_ZEROED().
This commit is contained in:
parent
01885f533d
commit
f376e4f93b
|
@ -1,3 +1,8 @@
|
||||||
|
2015-12-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
|
* libc/include/sys/reent.h (_REENT_INIT_PTR_ZEROED): New.
|
||||||
|
(_REENT_INIT_PTR): Define only once and use _REENT_INIT_PTR_ZEROED().
|
||||||
|
|
||||||
2015-12-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
2015-12-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
* libc/include/sys/_sigset.h: New.
|
* libc/include/sys/_sigset.h: New.
|
||||||
|
|
|
@ -446,9 +446,8 @@ extern const struct __sFILE_fake __sf_fake_stderr;
|
||||||
_NULL \
|
_NULL \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _REENT_INIT_PTR(var) \
|
#define _REENT_INIT_PTR_ZEROED(var) \
|
||||||
{ memset((var), 0, sizeof(*(var))); \
|
{ (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
|
||||||
(var)->_stdin = (__FILE *)&__sf_fake_stdin; \
|
|
||||||
(var)->_stdout = (__FILE *)&__sf_fake_stdout; \
|
(var)->_stdout = (__FILE *)&__sf_fake_stdout; \
|
||||||
(var)->_stderr = (__FILE *)&__sf_fake_stderr; \
|
(var)->_stderr = (__FILE *)&__sf_fake_stderr; \
|
||||||
(var)->_current_locale = "C"; \
|
(var)->_current_locale = "C"; \
|
||||||
|
@ -694,9 +693,8 @@ struct _reent
|
||||||
{_NULL, 0, _NULL} \
|
{_NULL, 0, _NULL} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _REENT_INIT_PTR(var) \
|
#define _REENT_INIT_PTR_ZEROED(var) \
|
||||||
{ memset((var), 0, sizeof(*(var))); \
|
{ (var)->_stdin = &(var)->__sf[0]; \
|
||||||
(var)->_stdin = &(var)->__sf[0]; \
|
|
||||||
(var)->_stdout = &(var)->__sf[1]; \
|
(var)->_stdout = &(var)->__sf[1]; \
|
||||||
(var)->_stderr = &(var)->__sf[2]; \
|
(var)->_stderr = &(var)->__sf[2]; \
|
||||||
(var)->_current_locale = "C"; \
|
(var)->_current_locale = "C"; \
|
||||||
|
@ -745,6 +743,11 @@ struct _reent
|
||||||
|
|
||||||
#endif /* !_REENT_SMALL */
|
#endif /* !_REENT_SMALL */
|
||||||
|
|
||||||
|
#define _REENT_INIT_PTR(var) \
|
||||||
|
{ memset((var), 0, sizeof(*(var))); \
|
||||||
|
_REENT_INIT_PTR_ZEROED(var); \
|
||||||
|
}
|
||||||
|
|
||||||
/* This value is used in stdlib/misc.c. reent/reent.c has to know it
|
/* This value is used in stdlib/misc.c. reent/reent.c has to know it
|
||||||
as well to make sure the freelist is correctly free'd. Therefore
|
as well to make sure the freelist is correctly free'd. Therefore
|
||||||
we define it here, rather than in stdlib/misc.c, as before. */
|
we define it here, rather than in stdlib/misc.c, as before. */
|
||||||
|
|
Loading…
Reference in New Issue