Lines Matching full:ci

139 close_shared(struct _citrus_iconv_shared *ci)  in close_shared()  argument
141 if (ci) { in close_shared()
142 if (ci->ci_module) { in close_shared()
143 if (ci->ci_ops) { in close_shared()
144 if (ci->ci_closure) in close_shared()
145 (*ci->ci_ops->io_uninit_shared)(ci); in close_shared()
146 free(ci->ci_ops); in close_shared()
148 _citrus_unload_module(ci->ci_module); in close_shared()
150 free(ci); in close_shared()
160 struct _citrus_iconv_shared *ci; in open_shared() local
181 ci = malloc(sizeof(*ci)+len_convname+1); in open_shared()
182 if (!ci) { in open_shared()
186 ci->ci_module = NULL; in open_shared()
187 ci->ci_ops = NULL; in open_shared()
188 ci->ci_closure = NULL; in open_shared()
189 ci->ci_convname = (void *)&ci[1]; in open_shared()
190 memcpy(ci->ci_convname, convname, len_convname+1); in open_shared()
193 ret = _citrus_load_module(&ci->ci_module, module); in open_shared()
199 _citrus_find_getops(ci->ci_module, module, "iconv"); in open_shared()
204 ci->ci_ops = malloc(sizeof(*ci->ci_ops)); in open_shared()
205 if (!ci->ci_ops) { in open_shared()
209 ret = (*getops)(ci->ci_ops, sizeof(*ci->ci_ops), in open_shared()
215 if (ci->ci_ops->io_abi_version == 1) { in open_shared()
221 if (ci->ci_ops->io_init_shared == NULL || in open_shared()
222 ci->ci_ops->io_uninit_shared == NULL || in open_shared()
223 ci->ci_ops->io_init_context == NULL || in open_shared()
224 ci->ci_ops->io_uninit_context == NULL || in open_shared()
225 ci->ci_ops->io_convert == NULL) { in open_shared()
231 ret = (*ci->ci_ops->io_init_shared)(ci, basedir, src, dst, in open_shared()
237 *rci = ci; in open_shared()
241 close_shared(ci); in open_shared()
252 match_func(struct _citrus_iconv_shared * __restrict ci, in match_func() argument
255 return strcmp(ci->ci_convname, key); in match_func()
264 struct _citrus_iconv_shared * ci; in get_shared() local
273 _CITRUS_HASH_SEARCH(&shared_pool, ci, ci_hash_entry, match_func, in get_shared()
275 if (ci != NULL) { in get_shared()
277 if (ci->ci_used_count == 0) { in get_shared()
278 TAILQ_REMOVE(&shared_unused, ci, ci_tailq_entry); in get_shared()
281 ci->ci_used_count++; in get_shared()
282 *rci = ci; in get_shared()
287 ret = open_shared(&ci, basedir, convname, src, dst); in get_shared()
291 _CITRUS_HASH_INSERT(&shared_pool, ci, ci_hash_entry, hashval); in get_shared()
292 ci->ci_used_count = 1; in get_shared()
293 *rci = ci; in get_shared()
302 release_shared(struct _citrus_iconv_shared * __restrict ci) in release_shared() argument
306 ci->ci_used_count--; in release_shared()
307 if (ci->ci_used_count == 0) { in release_shared()
310 TAILQ_INSERT_TAIL(&shared_unused, ci, ci_tailq_entry); in release_shared()
313 ci = TAILQ_FIRST(&shared_unused); in release_shared()
314 _DIAGASSERT(ci != NULL); in release_shared()
315 TAILQ_REMOVE(&shared_unused, ci, ci_tailq_entry); in release_shared()
316 _CITRUS_HASH_REMOVE(ci, ci_hash_entry); in release_shared()
318 close_shared(ci); in release_shared()
335 struct _citrus_iconv_shared *ci = NULL; in _citrus_iconv_open() local
358 ret = get_shared(&ci, basedir, realsrc, realdst); in _citrus_iconv_open()
366 release_shared(ci); in _citrus_iconv_open()
369 cv->cv_shared = ci; in _citrus_iconv_open()
370 ret = (*ci->ci_ops->io_init_context)(cv); in _citrus_iconv_open()
372 release_shared(ci); in _citrus_iconv_open()