Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-12-14 11:57:54 +0300
committerCorinna Vinschen <corinna@vinschen.de>2015-12-14 17:44:28 +0300
commitf376e4f93b6d8df62590122d33fdf7239a1f86a7 (patch)
tree5102c4da1b84c17c02599c42059bed3ed9fe0dbd
parent01885f533de81ff73e9da1519a4b5f2316b49f86 (diff)
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().
-rw-r--r--newlib/ChangeLog5
-rw-r--r--newlib/libc/include/sys/reent.h15
2 files changed, 14 insertions, 6 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 681a57300..b1b458515 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,5 +1,10 @@
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>
+
* libc/include/sys/_sigset.h: New.
* libc/include/sys/select.h: Do not include <sys/types.h> and
<sys/time.h> to avoid cyclic header file dependencies. Include
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index ce5b3eda7..5481ca234 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -446,9 +446,8 @@ extern const struct __sFILE_fake __sf_fake_stderr;
_NULL \
}
-#define _REENT_INIT_PTR(var) \
- { memset((var), 0, sizeof(*(var))); \
- (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
+#define _REENT_INIT_PTR_ZEROED(var) \
+ { (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
(var)->_stdout = (__FILE *)&__sf_fake_stdout; \
(var)->_stderr = (__FILE *)&__sf_fake_stderr; \
(var)->_current_locale = "C"; \
@@ -694,9 +693,8 @@ struct _reent
{_NULL, 0, _NULL} \
}
-#define _REENT_INIT_PTR(var) \
- { memset((var), 0, sizeof(*(var))); \
- (var)->_stdin = &(var)->__sf[0]; \
+#define _REENT_INIT_PTR_ZEROED(var) \
+ { (var)->_stdin = &(var)->__sf[0]; \
(var)->_stdout = &(var)->__sf[1]; \
(var)->_stderr = &(var)->__sf[2]; \
(var)->_current_locale = "C"; \
@@ -745,6 +743,11 @@ struct _reent
#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
as well to make sure the freelist is correctly free'd. Therefore
we define it here, rather than in stdlib/misc.c, as before. */