Skip to content

Commit

Permalink
Merge commit 'origin/master' into fedora/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schwab committed Sep 3, 2009
2 parents 00cf698 + 01034d7 commit 3f3be09
Showing 11 changed files with 134 additions and 48 deletions.
23 changes: 23 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2009-09-01 Andreas Schwab <schwab@redhat.com>

* hesiod/nss_hesiod/hesiod-grp.c (internal_gid_from_group): Fix
parsing of group entry.

2009-09-02 Andreas Schwab <schwab@redhat.com>

* libio/wfileops.c (_IO_wfile_seekoff): Account for readahead in
external buffer. Always discard readahead in internal buffer.
* libio/Makefile (tests): Add bug-wsetpos.
* libio/bug-wsetpos.c: New file.

2009-09-02 Jakub Jelinek <jakub@redhat.com>

* sysdeps/x86_64/multiarch/strstr-c.c (__strstr_sse42, __strstr_sse2):
Add attribute_hidden.
* sysdeps/x86_64/multiarch/strcasestr-c.c (__strcasestr_sse42,
__strcasestr_sse2): Likewise.
* sysdeps/x86_64/multiarch/s_fma.c (__fma_sse2): Add attribute_hidden.
(__fma_fma): Make static.
* sysdeps/x86_64/multiarch/s_fmaf.c (__fmaf_sse2): Add attribute_hidden.
(__fmaf_fma): Make static.

2009-08-31 Andreas Schwab <schwab@redhat.com>

* libio/wfileops.c (_IO_wfile_seekoff): Remove dead code and
8 changes: 3 additions & 5 deletions hesiod/nss_hesiod/hesiod-grp.c
Original file line number Diff line number Diff line change
@@ -139,21 +139,19 @@ internal_gid_from_group (void *context, const char *groupname, gid_t *group)
{
char *p = *grp_res;

/* Skip to third field. */
while (*p != '\0' && *p != ':')
++p;
while (*p != '\0' && *p == ':')
if (*p != '\0')
++p;
while (*p != '\0' && *p != ':')
++p;
while (*p != '\0' && *p == ':')
++p;
if (*p == ':')
if (*p != '\0')
{
char *endp;
char *q = ++p;
long int val;

q = p;
while (*q != '\0' && *q != ':')
++q;

2 changes: 1 addition & 1 deletion libio/Makefile
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
tst-memstream1 tst-memstream2 \
tst-wmemstream1 tst-wmemstream2 \
bug-memstream1 bug-wmemstream1 \
tst-setvbuf1 tst-popen1 tst-fgetwc
tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos
test-srcs = test-freopen

all: # Make this the default target; it will be defined in Rules.
75 changes: 75 additions & 0 deletions libio/bug-wsetpos.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* Test program for fsetpos on a wide character stream. */

#include <assert.h>
#include <stdio.h>
#include <wchar.h>

static void do_prepare (void);
#define PREPARE(argc, argv) do_prepare ()
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include <test-skeleton.c>

static const char pattern[] = "12345";
static char *temp_file;

static void
do_prepare (void)
{
int fd = create_temp_file ("bug-wsetpos.", &temp_file);
if (fd == -1)
{
printf ("cannot create temporary file: %m\n");
exit (1);
}
write (fd, pattern, sizeof (pattern));
close (fd);
}

static int
do_test (void)
{
FILE *fp = fopen (temp_file, "r");
fpos_t pos;
wchar_t c;

if (fp == NULL)
{
printf ("fdopen: %m\n");
return 1;
}

c = fgetwc (fp); assert (c == L'1');
c = fgetwc (fp); assert (c == L'2');

if (fgetpos (fp, &pos) == EOF)
{
printf ("fgetpos: %m\n");
return 1;
}

rewind (fp);
if (ferror (fp))
{
printf ("rewind: %m\n");
return 1;
}

c = fgetwc (fp); assert (c == L'1');

if (fsetpos (fp, &pos) == EOF)
{
printf ("fsetpos: %m\n");
return 1;
}

c = fgetwc (fp);
if (c != L'3')
{
puts ("fsetpos failed");
return 1;
}

puts ("Test succeeded.");
return 0;
}
49 changes: 14 additions & 35 deletions libio/wfileops.c
Original file line number Diff line number Diff line change
@@ -631,8 +631,12 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
clen = (*cv->__codecvt_do_encoding) (cv);

if (clen > 0)
offset -= (fp->_wide_data->_IO_read_end
- fp->_wide_data->_IO_read_ptr) * clen;
{
offset -= (fp->_wide_data->_IO_read_end
- fp->_wide_data->_IO_read_ptr) * clen;
/* Adjust by readahead in external buffer. */
offset -= fp->_IO_read_end - fp->_IO_read_ptr;
}
else
{
int nread;
@@ -690,39 +694,11 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
fp->_IO_buf_base + (offset - start_offset),
fp->_IO_read_end);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);

/* Now set the pointer for the internal buffer. This
might be an iterative process. Though the read
pointer is somewhere in the current external buffer
this does not mean we can convert this whole buffer
at once fitting in the internal buffer. */
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
read_ptr_copy = fp->_IO_read_base;
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_base;
do
{
wchar_t buffer[1024];
wchar_t *ignore;
status = (*cd->__codecvt_do_in) (cd,
&fp->_wide_data->_IO_state,
read_ptr_copy,
fp->_IO_read_ptr,
&read_ptr_copy,
buffer,
buffer
+ (sizeof (buffer)
/ sizeof (buffer[0])),
&ignore);
if (status != __codecvt_ok && status != __codecvt_partial)
{
fp->_flags |= _IO_ERR_SEEN;
goto dumb;
}
}
while (read_ptr_copy != fp->_IO_read_ptr);

fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_base;

_IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base);
_IO_wsetp (fp, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base);
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
goto resync;
}
@@ -760,6 +736,9 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
fp->_IO_buf_base + count);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
_IO_wsetp (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
fp->_offset = result + count;
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
return offset;
8 changes: 8 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2009-09-02 Suzuki K P <suzuki@in.ibm.com>
Joseph Myers <joseph@codesourcery.com>

[BZ #7094]
* sysdeps/unix/sysv/linux/timer_create.c (timer_create):
Initialize the sigev_notify field for newly created timer to make sure
the timer gets deleted from the active timer's list upon timer_delete.

2009-08-27 Andrew Stubbs <ams@codesourcery.com>

* sysdeps/unix/sysv/linux/sh/lowlevellock.S (__lll_timedlock_wait):
3 changes: 2 additions & 1 deletion nptl/sysdeps/unix/sysv/linux/timer_create.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003,2004, 2007 Free Software Foundation, Inc.
/* Copyright (C) 2003,2004, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -167,6 +167,7 @@ timer_create (clock_id, evp, timerid)
/* Copy the thread parameters the user provided. */
newp->sival = evp->sigev_value;
newp->thrfunc = evp->sigev_notify_function;
newp->sigev_notify = SIGEV_THREAD;

/* We cannot simply copy the thread attributes since the
implementation might keep internal information for
4 changes: 2 additions & 2 deletions sysdeps/x86_64/multiarch/s_fma.c
Original file line number Diff line number Diff line change
@@ -24,10 +24,10 @@

#ifdef HAVE_AVX_SUPPORT

extern double __fma_sse2 (double x, double y, double z);
extern double __fma_sse2 (double x, double y, double z) attribute_hidden;


double
static double
__fma_fma (double x, double y, double z)
{
asm ("vfmadd213sd %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z));
4 changes: 2 additions & 2 deletions sysdeps/x86_64/multiarch/s_fmaf.c
Original file line number Diff line number Diff line change
@@ -23,10 +23,10 @@

#ifdef HAVE_AVX_SUPPORT

extern float __fmaf_sse2 (float x, float y, float z);
extern float __fmaf_sse2 (float x, float y, float z) attribute_hidden;


float
static float
__fmaf_fma (float x, float y, float z)
{
asm ("vfmadd213ss %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z));
3 changes: 2 additions & 1 deletion sysdeps/x86_64/multiarch/strcasestr-c.c
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@

#include "string/strcasestr.c"

extern char *__strcasestr_sse42 (const char *, const char *);
extern char *__strcasestr_sse42 (const char *, const char *) attribute_hidden;
extern __typeof (__strcasestr_sse2) __strcasestr_sse2 attribute_hidden;

#if 1
libc_ifunc (__strcasestr,
3 changes: 2 additions & 1 deletion sysdeps/x86_64/multiarch/strstr-c.c
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@

#include "string/strstr.c"

extern char *__strstr_sse42 (const char *, const char *);
extern char *__strstr_sse42 (const char *, const char *) attribute_hidden;
extern __typeof (__strstr_sse2) __strstr_sse2 attribute_hidden;

libc_ifunc (strstr, HAS_SSE4_2 ? __strstr_sse42 : __strstr_sse2);

0 comments on commit 3f3be09

Please sign in to comment.