Skip to content

Commit

Permalink
[BZ #5443]
Browse files Browse the repository at this point in the history
2008-04-11  Jakub Jelinek  <jakub@redhat.com>
	[BZ #5443]
	* time/era.c: Transform __libc_setlocale_lock into rwlock.
	* time/alt_digit.c: Likewise.
	* wcsmbs/wcsmbsload.c: Likewise.
  • Loading branch information
Ulrich Drepper committed Apr 11, 2008
1 parent 1db5b6f commit 91e3254
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2008-04-11 Jakub Jelinek <jakub@redhat.com>

[BZ #5443]
* time/era.c: Transform __libc_setlocale_lock into rwlock.
* time/alt_digit.c: Likewise.
* wcsmbs/wcsmbsload.c: Likewise.

2008-04-10 Ulrich Drepper <drepper@redhat.com>

* version.h (VERSION): Bump to 2.8.
Expand Down
16 changes: 8 additions & 8 deletions time/alt_digit.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Helper functions used by strftime/strptime to handle alternate digits.
Copyright (C) 1995-2001,02 Free Software Foundation, Inc.
Copyright (C) 1995-2002, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand All @@ -24,7 +24,7 @@
#include <string.h>

/* Some of the functions here must not be used while setlocale is called. */
__libc_lock_define (extern, __libc_setlocale_lock attribute_hidden)
__libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)

#define CURRENT(item) (current->values[_NL_ITEM_INDEX (item)].string)
#define CURRENT_WSTR(item) \
Expand Down Expand Up @@ -77,7 +77,7 @@ _nl_get_alt_digit (unsigned int number, struct locale_data *current)
if (number >= 100 || CURRENT (ALT_DIGITS)[0] == '\0')
return NULL;

__libc_lock_lock (__libc_setlocale_lock);
__libc_rwlock_wrlock (__libc_setlocale_lock);

if (current->private.time == NULL
|| ! current->private.time->alt_digits_initialized)
Expand All @@ -88,7 +88,7 @@ _nl_get_alt_digit (unsigned int number, struct locale_data *current)
? current->private.time->alt_digits[number]
: NULL);

__libc_lock_unlock (__libc_setlocale_lock);
__libc_rwlock_unlock (__libc_setlocale_lock);

return result;
}
Expand All @@ -104,7 +104,7 @@ _nl_get_walt_digit (unsigned int number, struct locale_data *current)
if (number >= 100 || CURRENT_WSTR (_NL_WALT_DIGITS)[0] == L'\0')
return NULL;

__libc_lock_lock (__libc_setlocale_lock);
__libc_rwlock_wrlock (__libc_setlocale_lock);

if (current->private.time == NULL)
{
Expand Down Expand Up @@ -141,7 +141,7 @@ _nl_get_walt_digit (unsigned int number, struct locale_data *current)
result = data->walt_digits[number];

out:
__libc_lock_unlock (__libc_setlocale_lock);
__libc_rwlock_unlock (__libc_setlocale_lock);

return (wchar_t *) result;
}
Expand All @@ -159,7 +159,7 @@ _nl_parse_alt_digit (const char **strp, struct locale_data *current)
if (CURRENT_WSTR (_NL_WALT_DIGITS)[0] == L'\0')
return result;

__libc_lock_lock (__libc_setlocale_lock);
__libc_rwlock_wrlock (__libc_setlocale_lock);

if (current->private.time == NULL
|| ! current->private.time->alt_digits_initialized)
Expand All @@ -184,7 +184,7 @@ _nl_parse_alt_digit (const char **strp, struct locale_data *current)
}
}

__libc_lock_unlock (__libc_setlocale_lock);
__libc_rwlock_unlock (__libc_setlocale_lock);

if (result != -1)
*strp += maxlen;
Expand Down
8 changes: 4 additions & 4 deletions time/era.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Helper functions used by strftime/strptime to handle locale-specific "eras".
Copyright (C) 1995-2001,02 Free Software Foundation, Inc.
Copyright (C) 1995-2002, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand All @@ -24,7 +24,7 @@
#include <string.h>

/* Some of the functions here must not be used while setlocale is called. */
__libc_lock_define (extern, __libc_setlocale_lock attribute_hidden)
__libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)

#define CURRENT(item) (current->values[_NL_ITEM_INDEX (item)].string)
#define CURRENT_WORD(item) (current->values[_NL_ITEM_INDEX (item)].word)
Expand All @@ -45,7 +45,7 @@ _nl_init_era_entries (struct locale_data *current)
if (CURRENT_WORD (_NL_TIME_ERA_NUM_ENTRIES) == 0)
return;

__libc_lock_lock (__libc_setlocale_lock);
__libc_rwlock_wrlock (__libc_setlocale_lock);

if (current->private.time == NULL)
{
Expand Down Expand Up @@ -135,7 +135,7 @@ _nl_init_era_entries (struct locale_data *current)
}

out:
__libc_lock_unlock (__libc_setlocale_lock);
__libc_rwlock_unlock (__libc_setlocale_lock);
}

struct era_entry *
Expand Down
8 changes: 4 additions & 4 deletions wcsmbs/wcsmbsload.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1998-2002,2004,2005 Free Software Foundation, Inc.
/* Copyright (C) 1998-2002,2004,2005,2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Expand Down Expand Up @@ -145,15 +145,15 @@ __wcsmbs_getfct (const char *to, const char *from, size_t *nstepsp)


/* Some of the functions here must not be used while setlocale is called. */
__libc_lock_define (extern, __libc_setlocale_lock attribute_hidden)
__libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)

/* Load conversion functions for the currently selected locale. */
void
internal_function
__wcsmbs_load_conv (struct locale_data *new_category)
{
/* Acquire the lock. */
__libc_lock_lock (__libc_setlocale_lock);
__libc_rwlock_wrlock (__libc_setlocale_lock);

/* We should repeat the test since while we waited some other thread
might have run this function. */
Expand Down Expand Up @@ -211,7 +211,7 @@ __wcsmbs_load_conv (struct locale_data *new_category)
}
}

__libc_lock_unlock (__libc_setlocale_lock);
__libc_rwlock_unlock (__libc_setlocale_lock);
}


Expand Down

0 comments on commit 91e3254

Please sign in to comment.