MySQL 8.3.0
Source Code Documentation
xcom_common.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef XCOM_COMMON_H
24#define XCOM_COMMON_H
25
26#include <limits.h>
27
28#ifndef XCOM_STANDALONE
29#include "my_compiler.h"
30#include "xcom/xcom.h"
31#else
32#ifdef HAVE_STDINT_H
33#include <stdint.h>
34#endif
35#endif
36
37#ifndef __STDC_FORMAT_MACROS
38#define __STDC_FORMAT_MACROS
39#endif
40#ifndef _WIN32
41#include <inttypes.h>
42#endif
43
44#ifndef XCOM_STANDALONE
45typedef unsigned short xcom_port;
46#else
47#ifdef HAVE_STDINT_H
48typedef uint16_t xcom_port;
49#else
50typedef unsigned short xcom_port;
51#endif
52#endif
53
54#define number_is_valid_port(n) ((n) > 0 && (n) <= (int)UINT16_MAX)
55
56#ifndef MAX
57#define MAX(x, y) ((x) > (y) ? (x) : (y))
58#endif
59#ifndef MIN
60#define MIN(x, y) ((x) < (y) ? (x) : (y))
61#endif
62
63#ifndef idx_check_ret
64#define idx_check_ret(x, limit, ret) \
65 if (x < 0 || x >= limit) { \
66 g_critical("index out of range " #x " < 0 || " #x " >= " #limit " %s:%d", \
67 __FILE__, __LINE__); \
68 return ret; \
69 } else
70#define idx_check_fail(x, limit) \
71 if (x < 0 || x >= limit) { \
72 g_critical("index out of range " #x " < 0 || " #x " >= " #limit " %s:%d", \
73 __FILE__, __LINE__); \
74 abort(); \
75 } else
76#endif
77
78#define BSD_COMP
79
80#endif
Header for compiler-dependent features.
unsigned short xcom_port
Definition: xcom_common.h:45