]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - time/era.c
Update automatically-generated copyright dates
[thirdparty/glibc.git] / time / era.c
index a8d2237338564839a92b086a24a8c1c6575a151c..43528ad0d2a37b71c31acf46e4d9d405d0119065 100644 (file)
@@ -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-2022 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
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #include "../locale/localeinfo.h"
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
 #include <stdlib.h>
 #include <wchar.h>
 #include <string.h>
+#include <stdint.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)
@@ -35,8 +35,8 @@ __libc_lock_define (extern, __libc_setlocale_lock attribute_hidden)
 
 /* Look up the era information in CURRENT's locale strings and
    cache it in CURRENT->private.  */
-static void internal_function
-_nl_init_era_entries (struct locale_data *current)
+static void
+_nl_init_era_entries (struct __locale_data *current)
 {
   size_t cnt;
   struct lc_time_data *data;
@@ -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)
     {
@@ -83,7 +83,7 @@ _nl_init_era_entries (struct locale_data *current)
              data->num_eras = 0;
              data->eras = NULL;
            }
-          else
+         else
            {
              const char *ptr = CURRENT (_NL_TIME_ERA_ENTRIES);
              data->num_eras = new_num_eras;
@@ -122,11 +122,11 @@ _nl_init_era_entries (struct locale_data *current)
 
                  /* Set and skip wide era name.  */
                  new_eras[cnt].era_wname = (wchar_t *) ptr;
-                 ptr = (char *) (wcschr ((wchar_t *) ptr, L'\0') + 1);
+                 ptr = (char *) (__wcschr ((wchar_t *) ptr, L'\0') + 1);
 
                  /* Set and skip wide era format.  */
                  new_eras[cnt].era_wformat = (wchar_t *) ptr;
-                 ptr = (char *) (wcschr ((wchar_t *) ptr, L'\0') + 1);
+                 ptr = (char *) (__wcschr ((wchar_t *) ptr, L'\0') + 1);
                }
            }
        }
@@ -135,12 +135,11 @@ _nl_init_era_entries (struct locale_data *current)
     }
 
  out:
-  __libc_lock_unlock (__libc_setlocale_lock);
+  __libc_rwlock_unlock (__libc_setlocale_lock);
 }
 
 struct era_entry *
-internal_function
-_nl_get_era_entry (const struct tm *tp, struct locale_data *current)
+_nl_get_era_entry (const struct tm *tp, struct __locale_data *current)
 {
   if (current->private.time == NULL || !current->private.time->era_initialized)
     _nl_init_era_entries (current);
@@ -166,8 +165,7 @@ _nl_get_era_entry (const struct tm *tp, struct locale_data *current)
 
 
 struct era_entry *
-internal_function
-_nl_select_era_entry (int cnt, struct locale_data *current)
+_nl_select_era_entry (int cnt, struct __locale_data *current)
 {
   if (current->private.time == NULL || !current->private.time->era_initialized)
     _nl_init_era_entries (current);