MySQL 9.0.0
Source Code Documentation
xcom_common.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef XCOM_COMMON_H
25#define XCOM_COMMON_H
26
27#include <limits.h>
28
29#ifndef XCOM_STANDALONE
30#include "my_compiler.h"
31#include "xcom/xcom.h"
32#else
33#ifdef HAVE_STDINT_H
34#include <stdint.h>
35#endif
36#endif
37
38#ifndef __STDC_FORMAT_MACROS
39#define __STDC_FORMAT_MACROS
40#endif
41#ifndef _WIN32
42#include <inttypes.h>
43#endif
44
45#ifndef XCOM_STANDALONE
46typedef unsigned short xcom_port;
47#else
48#ifdef HAVE_STDINT_H
49typedef uint16_t xcom_port;
50#else
51typedef unsigned short xcom_port;
52#endif
53#endif
54
55#define number_is_valid_port(n) ((n) > 0 && (n) <= (int)UINT16_MAX)
56
57#ifndef MAX
58#define MAX(x, y) ((x) > (y) ? (x) : (y))
59#endif
60#ifndef MIN
61#define MIN(x, y) ((x) < (y) ? (x) : (y))
62#endif
63
64#ifndef idx_check_ret
65#define idx_check_ret(x, limit, ret) \
66 if (x < 0 || x >= limit) { \
67 g_critical("index out of range " #x " < 0 || " #x " >= " #limit " %s:%d", \
68 __FILE__, __LINE__); \
69 return ret; \
70 } else
71#define idx_check_fail(x, limit) \
72 if (x < 0 || x >= limit) { \
73 g_critical("index out of range " #x " < 0 || " #x " >= " #limit " %s:%d", \
74 __FILE__, __LINE__); \
75 abort(); \
76 } else
77#endif
78
79#define BSD_COMP
80
81#endif
Header for compiler-dependent features.
unsigned short xcom_port
Definition: xcom_common.h:46