Cleanup header files

- All now include maxscale/cdefs.h as the very first file.
- MXS_[BEGIN|END]_DECLS added to all C-headers.
  Strictly speaking not necessary for private headers, but
  does not hurt either.
- Include guards moved to the very top of the file.
- #pragma once added.
This commit is contained in:
Johan Wikman
2016-10-14 11:51:44 +03:00
parent dc1f599b49
commit 1a978be6b6
86 changed files with 647 additions and 206 deletions

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _MXS_AVRO_H
#define _MXS_AVRO_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -15,8 +18,7 @@
* MaxScale AVRO router
*
*/
#ifndef _MXS_AVRO_H
#define _MXS_AVRO_H
#include <maxscale/cdefs.h>
#include <stdbool.h>
#include <stdint.h>
#include <blr_constants.h>
@ -35,6 +37,8 @@
#include <sqlite3.h>
#include <maxscale/protocol/mysql.h>
MXS_BEGIN_DECLS
/** SQLite3 version 3.7.14 introduced the new v2 close interface */
#if SQLITE_VERSION_NUMBER < 3007014
#define sqlite3_close_v2 sqlite3_close
@ -312,4 +316,6 @@ extern void table_map_remap(uint8_t *ptr, uint8_t hdr_len, TABLE_MAP *map);
#define AVRO_CS_BUSY 0x0001
#define AVRO_WAIT_DATA 0x0002
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _BLR_H
#define _BLR_H
/*
@ -37,6 +38,7 @@
*
* @endverbatim
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/buffer.h>
#include <pthread.h>
@ -46,6 +48,8 @@
#include <zlib.h>
#include <maxscale/protocol/mysql.h>
MXS_BEGIN_DECLS
#define BINLOG_FNAMELEN 255
#define BLR_PROTOCOL "MySQLBackend"
#define BINLOG_MAGIC { 0xfe, 0x62, 0x69, 0x6e }
@ -676,4 +680,6 @@ extern bool blr_send_event(blr_thread_role_t role,
REP_HEADER *hdr,
uint8_t *buf);
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXINFO_H
#define _MAXINFO_H
/*
@ -12,10 +13,13 @@
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#include <maxscale/cdefs.h>
#include <maxscale/service.h>
#include <maxscale/session.h>
#include <maxscale/spinlock.h>
MXS_BEGIN_DECLS
/**
* @file maxinfo.h The MaxScale information schema provider
*
@ -138,4 +142,7 @@ extern void maxinfo_send_parse_error(DCB *, char *, PARSE_ERROR);
extern void maxinfo_send_error(DCB *, int, char *);
extern RESULTSET *maxinfo_variables();
extern RESULTSET *maxinfo_status();
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _READCONNECTION_H
#define _READCONNECTION_H
/*
@ -25,8 +26,12 @@
*
* @endverbatim
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
MXS_BEGIN_DECLS
/**
* Internal structure used to define the set of backend servers we are routing
* connections to. This provides the storage for routing module specific data
@ -84,4 +89,7 @@ typedef struct router_instance
struct router_instance
*next;
} ROUTER_INSTANCE;
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _RWSPLITROUTER_H
#define _RWSPLITROUTER_H
/*
@ -24,10 +25,13 @@
* @endverbatim
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/hashtable.h>
#include <math.h>
MXS_BEGIN_DECLS
#undef PREP_STMT_CACHING
#if defined(PREP_STMT_CACHING)
@ -356,5 +360,6 @@ typedef struct router_instance
#define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
MXS_END_DECLS
#endif /*< _RWSPLITROUTER_H */

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _RWSPLIT_INTERNAL_H
#define _RWSPLIT_INTERNAL_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -18,15 +21,11 @@
* Created on 08 August 2016, 11:54
*/
#ifndef RWSPLIT_INTERNAL_H
#define RWSPLIT_INTERNAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <maxscale/cdefs.h>
#include <maxscale/query_classifier.h>
MXS_BEGIN_DECLS
/* This needs to be removed along with dependency on it - see the
* rwsplit_tmp_table_multi functions
*/
@ -145,5 +144,7 @@ qc_query_type_t determine_query_type(GWBUF *querybuf, int packet_type, bool non_
}
#endif
MXS_END_DECLS
#endif /* RWSPLIT_INTERNAL_H */

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _SCHEMAROUTER_H
#define _SCHEMAROUTER_H
/*
@ -23,14 +24,15 @@
*
* @endverbatim
*/
#ifndef PCRE2_CODE_UNIT_WIDTH
#define PCRE2_CODE_UNIT_WIDTH 8
#endif
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/hashtable.h>
#include <maxscale/protocol/mysql.h>
#include <pcre2.h>
#include <maxscale/pcre2.h>
MXS_BEGIN_DECLS
/**
* Bitmask values for the router session's initialization. These values are used
* to prevent responses from internal commands being forwarded to the client.
@ -377,4 +379,6 @@ typedef struct router_instance
#define BACKEND_TYPE(b) (SERVER_IS_MASTER((b)->backend_server) ? BE_MASTER : \
(SERVER_IS_SLAVE((b)->backend_server) ? BE_SLAVE : BE_UNDEFINED));
MXS_END_DECLS
#endif /*< _SCHEMAROUTER_H */

View File

@ -1,3 +1,6 @@
#pragma once
#ifndef _SHARDING_COMMON_HG
#define _SHARDING_COMMON_HG
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -11,9 +14,7 @@
* Public License.
*/
#ifndef _SHARDING_COMMON_HG
#define _SHARDING_COMMON_HG
#include <maxscale/cdefs.h>
#include <my_config.h>
#include <poll.h>
#include <maxscale/buffer.h>
@ -23,8 +24,12 @@
#include <maxscale/log_manager.h>
#include <maxscale/query_classifier.h>
MXS_BEGIN_DECLS
bool extract_database(GWBUF* buf, char* str);
void create_error_reply(char* fail_str, DCB* dcb);
bool change_current_db(char* dest, HASHTABLE* dbhash, GWBUF* buf);
MXS_END_DECLS
#endif