citrus_csmapper.c (ad30f8e79bd1007cc2476e491bd21b4f5e389e0a) | citrus_csmapper.c (ff0b75b897dde9a8455f0c199af9a75e424c38cc) |
---|---|
1/* $FreeBSD$ */ 2/* $NetBSD: citrus_csmapper.c,v 1.10 2009/01/11 02:46:24 christos Exp $ */ 3 4/*- 5 * Copyright (c)2003 Citrus Project, 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 44 unchanged lines hidden (view full) --- 53#include "citrus_csmapper.h" 54#include "citrus_pivot_file.h" 55#include "citrus_db.h" 56#include "citrus_db_hash.h" 57#include "citrus_lookup.h" 58 59static struct _citrus_mapper_area *maparea = NULL; 60 | 1/* $FreeBSD$ */ 2/* $NetBSD: citrus_csmapper.c,v 1.10 2009/01/11 02:46:24 christos Exp $ */ 3 4/*- 5 * Copyright (c)2003 Citrus Project, 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 44 unchanged lines hidden (view full) --- 53#include "citrus_csmapper.h" 54#include "citrus_pivot_file.h" 55#include "citrus_db.h" 56#include "citrus_db_hash.h" 57#include "citrus_lookup.h" 58 59static struct _citrus_mapper_area *maparea = NULL; 60 |
61static pthread_rwlock_t ma_lock = PTHREAD_RWLOCK_INITIALIZER; 62 |
|
61#define CS_ALIAS _PATH_CSMAPPER "/charset.alias" 62#define CS_PIVOT _PATH_CSMAPPER "/charset.pivot" 63 64 65/* ---------------------------------------------------------------------- */ 66 67static int 68get32(struct _region *r, uint32_t *rval) --- 240 unchanged lines hidden (view full) --- 309 310static struct _citrus_csmapper *csm_none = NULL; 311static int 312get_none(struct _citrus_mapper_area *__restrict ma, 313 struct _citrus_csmapper *__restrict *__restrict rcsm) 314{ 315 int ret; 316 | 63#define CS_ALIAS _PATH_CSMAPPER "/charset.alias" 64#define CS_PIVOT _PATH_CSMAPPER "/charset.pivot" 65 66 67/* ---------------------------------------------------------------------- */ 68 69static int 70get32(struct _region *r, uint32_t *rval) --- 240 unchanged lines hidden (view full) --- 311 312static struct _citrus_csmapper *csm_none = NULL; 313static int 314get_none(struct _citrus_mapper_area *__restrict ma, 315 struct _citrus_csmapper *__restrict *__restrict rcsm) 316{ 317 int ret; 318 |
317 WLOCK; | 319 WLOCK(&ma_lock); |
318 if (csm_none) { 319 *rcsm = csm_none; 320 ret = 0; 321 goto quit; 322 } 323 324 ret = _mapper_open_direct(ma, &csm_none, "mapper_none", ""); 325 if (ret) 326 goto quit; 327 _mapper_set_persistent(csm_none); 328 329 *rcsm = csm_none; 330 ret = 0; 331quit: | 320 if (csm_none) { 321 *rcsm = csm_none; 322 ret = 0; 323 goto quit; 324 } 325 326 ret = _mapper_open_direct(ma, &csm_none, "mapper_none", ""); 327 if (ret) 328 goto quit; 329 _mapper_set_persistent(csm_none); 330 331 *rcsm = csm_none; 332 ret = 0; 333quit: |
332 UNLOCK; | 334 UNLOCK(&ma_lock); |
333 return (ret); 334} 335 336int 337_citrus_csmapper_open(struct _citrus_csmapper * __restrict * __restrict rcsm, 338 const char * __restrict src, const char * __restrict dst, uint32_t flags, 339 unsigned long *rnorm) 340{ --- 43 unchanged lines hidden --- | 335 return (ret); 336} 337 338int 339_citrus_csmapper_open(struct _citrus_csmapper * __restrict * __restrict rcsm, 340 const char * __restrict src, const char * __restrict dst, uint32_t flags, 341 unsigned long *rnorm) 342{ --- 43 unchanged lines hidden --- |