Debian Codegraph @

runtime/unicode-helper.h

raw
1 /* This is the header file for unicode support.
2 *
3 * Currently, this is a dummy module.
4 * The following functions are wrappers which hopefully enable us to move
5 * from 8-bit chars to unicode with relative ease when we finally attack this
6 *
7 * Begun 2009-05-21 RGerhards
8 *
9 * Copyright (C) 2009-2016 by Rainer Gerhards and Adiscon GmbH
10 *
11 * This file is part of the rsyslog runtime library.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 * -or-
19 * see COPYING.ASL20 in the source distribution
20 *
21 * Unless required by applicable law or agreed to in writing, software
22 * distributed under the License is distributed on an "AS IS" BASIS,
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 * See the License for the specific language governing permissions and
25 * limitations under the License.
26 */
27 #ifndef INCLUDED_UNICODE_HELPER_H
28 #define INCLUDED_UNICODE_HELPER_H
29
30 #include <string.h>
31
32 #define ustrncpy(psz1, psz2, len) strncpy((char*)(psz1), (char*)(psz2), (len))
33 #define ustrdup(psz) (uchar*)strdup((char*)(psz))
34 #define ustrcmp(psz1, psz2) (strcmp((const char*)(psz1), (const char*)(psz2)))
35 #define ustrlen(psz) (strlen((const char*)(psz)))
36 #define UCHAR_CONSTANT(x) ((uchar*)(x))
37 #define CHAR_CONVERT(x) ((char*)(x))
38
39 /* Compare values of two instances/configs/queues especially during dynamic config reload */
40 #define USTR_EQUALS(var) \
41 ((pOld->var == NULL) ? (pNew->var == NULL) : (pNew->var != NULL && !ustrcmp(pOld->var, pNew->var)))
42 #define NUM_EQUALS(var) (pOld->var == pNew->var)
43
44 #endif /* multi-include protection */