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:
authorCorinna Vinschen <corinna@vinschen.de>2013-03-15 17:19:29 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-03-15 17:19:29 +0400
commit01aff1ea3752f4531599db435db787c8065b9963 (patch)
tree2915e413eae883943f668688944f09b3f3c4442e /newlib/libc/stdio
parentba4241416022484a69775ddc85ec16e040ba1a11 (diff)
* newlib/libc/stdio/findfp.c (glue_with_file): New.
(__sfmoreglue): Use glue_with_file to avoid alignment problems.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/findfp.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index 0beb1e5b0..7ab3bdba5 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -77,23 +77,27 @@ _DEFUN(std, (ptr, flags, file, data),
#endif
}
+struct glue_with_file {
+ struct _glue glue;
+ FILE file;
+};
+
struct _glue *
_DEFUN(__sfmoreglue, (d, n),
struct _reent *d _AND
register int n)
{
- struct _glue *g;
- FILE *p;
+ struct glue_with_file *g;
- g = (struct _glue *) _malloc_r (d, sizeof (*g) + n * sizeof (FILE));
+ g = (struct glue_with_file *)
+ _malloc_r (d, sizeof (*g) + (n - 1) * sizeof (FILE));
if (g == NULL)
return NULL;
- p = (FILE *) (g + 1);
- g->_next = NULL;
- g->_niobs = n;
- g->_iobs = p;
- memset (p, 0, n * sizeof (FILE));
- return g;
+ g->glue._next = NULL;
+ g->glue._niobs = n;
+ g->glue._iobs = &g->file;
+ memset (&g->file, 0, n * sizeof (FILE));
+ return &g->glue;
}
/*