1 /* Copyright (c) 2015, 2021, 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 #include <stdint.h>
28 #include <xcom/xcom.h>
29 #include "my_compiler.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 typedef uint16_t xcom_port;
36 #define number_is_valid_port(n) ((n) > 0 && (n) <= (int) UINT16_MAX)
37 
38 typedef void *gpointer;
39 typedef char	gchar;
40 typedef int	gboolean;
41 typedef struct timeval GTimeVal;
42 
43 #ifndef MAX
44 #define MAX(x,y) ((x) > (y) ? (x) : (y))
45 #endif
46 #ifndef MIN
47 #define MIN(x,y) ((x) < (y) ? (x) : (y))
48 #endif
49 
50 #define idx_check_ret(x,limit, ret) if(x < 0 || x >= limit){g_critical("index out of range " #x " < 0  || " #x " >= " #limit" %s:%d", __FILE__, __LINE__); return ret; }else
51 #define idx_check_fail(x,limit) if(x < 0 || x >= limit){g_critical("index out of range " #x " < 0  || " #x " >= " #limit" %s:%d", __FILE__, __LINE__);abort();}else
52 
53 #define BSD_COMP
54 
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif
61 
62