MySQL  8.0.19
Source Code Documentation
xcom_common.h
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
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 "plugin/group_replication/libmysqlgcs/include/xcom/xcom.h"
31 #else
32 #ifdef HAVE_STDINT_H
33 #include <stdint.h>
34 #endif
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #ifndef __STDC_FORMAT_MACROS
42 #define __STDC_FORMAT_MACROS
43 #endif
44 #include <inttypes.h>
45 
46 #ifndef XCOM_STANDALONE
47 typedef unsigned short xcom_port;
48 #else
49 #ifdef HAVE_STDINT_H
50 typedef uint16_t xcom_port;
51 #else
52 typedef unsigned short xcom_port;
53 #endif
54 #endif
55 
56 #define number_is_valid_port(n) ((n) > 0 && (n) <= (int)UINT16_MAX)
57 
58 #ifndef MAX
59 #define MAX(x, y) ((x) > (y) ? (x) : (y))
60 #endif
61 #ifndef MIN
62 #define MIN(x, y) ((x) < (y) ? (x) : (y))
63 #endif
64 
65 #ifndef idx_check_ret
66 #define idx_check_ret(x, limit, ret) \
67  if (x < 0 || x >= limit) { \
68  g_critical("index out of range " #x " < 0 || " #x " >= " #limit " %s:%d", \
69  __FILE__, __LINE__); \
70  return ret; \
71  } else
72 #define idx_check_fail(x, limit) \
73  if (x < 0 || x >= limit) { \
74  g_critical("index out of range " #x " < 0 || " #x " >= " #limit " %s:%d", \
75  __FILE__, __LINE__); \
76  abort(); \
77  } else
78 #endif
79 
80 #define BSD_COMP
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif
my_compiler.h
xcom_port
unsigned short xcom_port
Definition: xcom_common.h:47