mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-13 14:50:17 +00:00
(gen_steps): Set __counter initialy to 1.
(increment_counter): New function. Broken out of find_derivation. (find_derivation): No need for a lock. Increment counter only when the derivation was already available.
This commit is contained in:
parent
c8f1ce4ae8
commit
521c959a8c
@ -222,7 +222,7 @@ gen_steps (struct derivation_step *best, const char *toset,
|
||||
|
||||
result[step_cnt].shlib_handle = shlib_handle;
|
||||
result[step_cnt].modname = shlib_handle->name;
|
||||
result[step_cnt].counter = 0;
|
||||
result[step_cnt].counter = 1;
|
||||
result[step_cnt].fct = shlib_handle->fct;
|
||||
result[step_cnt].init_fct = shlib_handle->init_fct;
|
||||
result[step_cnt].end_fct = shlib_handle->end_fct;
|
||||
@ -281,6 +281,35 @@ 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 the user counter. */
|
||||
size_t cnt = nsteps;
|
||||
int result = __GCONV_OK;
|
||||
|
||||
while (cnt-- > 0)
|
||||
if (steps[cnt].__counter++ == 0)
|
||||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* The main function: find a possible derivation from the `fromset' (either
|
||||
the given name or the alias) to the `toset' (again with alias). */
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user