Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/intl/icu/source/common/uinit.cpp
Line
Count
Source (jump to first uncovered line)
1
// © 2016 and later: Unicode, Inc. and others.
2
// License & terms of use: http://www.unicode.org/copyright.html
3
/*
4
******************************************************************************
5
* Copyright (C) 2001-2015, International Business Machines
6
*                Corporation and others. All Rights Reserved.
7
******************************************************************************
8
*   file name:  uinit.cpp
9
*   encoding:   UTF-8
10
*   tab size:   8 (not used)
11
*   indentation:4
12
*
13
*   created on: 2001July05
14
*   created by: George Rhoten
15
*/
16
17
#include "unicode/utypes.h"
18
#include "unicode/icuplug.h"
19
#include "unicode/uclean.h"
20
#include "cmemory.h"
21
#include "icuplugimp.h"
22
#include "ucln_cmn.h"
23
#include "ucnv_io.h"
24
#include "umutex.h"
25
#include "utracimp.h"
26
27
U_NAMESPACE_BEGIN
28
29
static UInitOnce gICUInitOnce = U_INITONCE_INITIALIZER;
30
31
0
static UBool U_CALLCONV uinit_cleanup() {
32
0
    gICUInitOnce.reset();
33
0
    return TRUE;
34
0
}
35
36
static void U_CALLCONV
37
initData(UErrorCode &status)
38
3
{
39
#if UCONFIG_ENABLE_PLUGINS
40
    /* initialize plugins */
41
    uplug_init(&status);
42
#endif
43
44
3
#if !UCONFIG_NO_CONVERSION
45
3
    /*
46
3
     * 2005-may-02
47
3
     *
48
3
     * ICU4C 3.4 (jitterbug 4497) hardcodes the data for Unicode character
49
3
     * properties for APIs that want to be fast.
50
3
     * Therefore, we need not load them here nor check for errors.
51
3
     * Instead, we load the converter alias table to see if any ICU data
52
3
     * is available.
53
3
     * Users should really open the service objects they need and check
54
3
     * for errors there, to make sure that the actual items they need are
55
3
     * available.
56
3
     */
57
3
    ucnv_io_countKnownConverters(&status);
58
3
#endif
59
3
    ucln_common_registerCleanup(UCLN_COMMON_UINIT, uinit_cleanup);
60
3
}
61
62
U_NAMESPACE_END
63
64
U_NAMESPACE_USE
65
66
/*
67
 * ICU Initialization Function. Need not be called.
68
 */
69
U_CAPI void U_EXPORT2
70
3
u_init(UErrorCode *status) {
71
3
    UTRACE_ENTRY_OC(UTRACE_U_INIT);
72
3
    umtx_initOnce(gICUInitOnce, &initData, *status);
73
3
    UTRACE_EXIT_STATUS(*status);
74
3
}