]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Correctly transfer last patch from 2.2 branch.
authorUlrich Drepper <drepper@redhat.com>
Wed, 8 Dec 1999 16:51:14 +0000 (16:51 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 8 Dec 1999 16:51:14 +0000 (16:51 +0000)
iconv/gconv_db.c

index 53cffa4dc73b47be11c373fd79117e3c835b4d30..0d2f1a03e92213a1ad21752ffe8c34650c5e448d 100644 (file)
@@ -284,24 +284,24 @@ gen_steps (struct derivation_step *best, const char *toset,
 #ifndef STATIC_GCONV
 static int
 internal_function
-increment_counter (struct __gconv_step *steps, size_t nsteps)
+increment_counter (struct gconv_step *steps, size_t nsteps)
 {
   /* Increment the user counter.  */
   size_t cnt = nsteps;
-  int result = __GCONV_OK;
+  int result = GCONV_OK;
 
   while (cnt-- > 0)
-    if (steps[cnt].__counter++ == 0)
+    if (steps[cnt].counter++ == 0)
       {
-       steps[cnt].__shlib_handle =
-         __gconv_find_shlib (steps[cnt].__modname);
-       if (steps[cnt].__shlib_handle == NULL)
+       steps[cnt].shlib_handle =
+         __gconv_find_shlib (steps[cnt].modname);
+       if (steps[cnt].shlib_handle == NULL)
          {
            /* Oops, this is the second time we use this module (after
               unloading) and this time loading failed!?  */
            while (++cnt < nsteps)
-             __gconv_release_shlib (steps[cnt].__shlib_handle);
-           result = __GCONV_NOCONV;
+             __gconv_release_shlib (steps[cnt].shlib_handle);
+           result = GCONV_NOCONV;
            break;
          }
       }
@@ -318,19 +318,11 @@ find_derivation (const char *toset, const char *toset_expand,
                 const char *fromset, const char *fromset_expand,
                 struct gconv_step **handle, size_t *nsteps)
 {
-  __libc_lock_define_initialized (static, lock)
   struct derivation_step *first, *current, **lastp, *solution = NULL;
   int best_cost_hi = INT_MAX;
   int best_cost_lo = INT_MAX;
   int result;
 
-  result = derivation_lookup (fromset_expand ?: fromset, toset_expand ?: toset,
-                             handle, nsteps);
-  if (result == GCONV_OK)
-    return result;
-
-  __libc_lock_lock (lock);
-
   /* There is a small chance that this derivation is meanwhile found.  This
      can happen if in `find_derivation' we look for this derivation, didn't
      find it but at the same time another thread looked for this derivation. */
@@ -338,7 +330,9 @@ find_derivation (const char *toset, const char *toset_expand,
                              handle, nsteps);
   if (result == GCONV_OK)
     {
-      __libc_lock_unlock (lock);
+#ifndef STATIC_GCONV
+      result = increment_counter (*handle, *nsteps);
+#endif
       return result;
     }
 
@@ -633,8 +627,6 @@ find_derivation (const char *toset, const char *toset_expand,
   add_derivation (fromset_expand ?: fromset, toset_expand ?: toset,
                  *handle, *nsteps);
 
-  __libc_lock_unlock (lock);
-
   return result;
 }