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,5 +1,6 @@
#ifndef CACHE_H
#define CACHE_H
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_H
#define _MAXSCALE_FILTER_CACHE_CACHE_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -15,6 +16,8 @@
#include <limits.h>
MXS_BEGIN_DECLS
#define CACHE_DEBUG_NONE 0
#define CACHE_DEBUG_MATCHING 1
#define CACHE_DEBUG_NON_MATCHING 2
@ -35,4 +38,6 @@
// Integer value
#define CACHE_DEFAULT_DEBUG 0
MXS_END_DECLS
#endif

View File

@ -1,5 +1,6 @@
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_H
#define _MAXSCALE_FILTER_CACHE_CACHE_H
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_CACHE_STORAGE_API_H
#define _MAXSCALE_FILTER_CACHE_CACHE_STORAGE_API_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
@ -19,7 +20,7 @@
#include <maxscale/protocol/mysql.h>
#include <maxscale/skygw_debug.h>
EXTERN_C_BLOCK_BEGIN
MXS_BEGIN_DECLS
typedef enum cache_result
{
@ -116,6 +117,6 @@ typedef struct cache_storage_api
#define CACHE_STORAGE_ENTRY_POINT "CacheGetStorageAPI"
typedef CACHE_STORAGE_API* (*CacheGetStorageAPIFN)();
EXTERN_C_BLOCK_END
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_RULES_H
#define _MAXSCALE_FILTER_CACHE_RULES_H
/*
@ -13,12 +14,14 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include <stdbool.h>
#include <jansson.h>
#include <maxscale/buffer.h>
#include <maxscale/session.h>
#include <maxscale/pcre2.h>
MXS_BEGIN_DECLS
typedef enum cache_rule_attribute
{
@ -71,4 +74,6 @@ CACHE_RULES *cache_rules_parse(const char *json, uint32_t debug);
bool cache_rules_should_store(CACHE_RULES *rules, const char *default_db, const GWBUF* query);
bool cache_rules_should_use(CACHE_RULES *rules, const SESSION *session);
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MAXSCALE_FILTER_CACHE_STORAGE_H
#define _MAXSCALE_FILTER_CACHE_STORAGE_H
/*
@ -13,8 +14,11 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include "cache_storage_api.h"
MXS_BEGIN_DECLS
typedef struct cache_storage_module_t
{
void* handle;
@ -24,4 +28,6 @@ typedef struct cache_storage_module_t
CACHE_STORAGE_MODULE* cache_storage_open(const char *name);
void cache_storage_close(CACHE_STORAGE_MODULE *module);
MXS_END_DECLS
#endif

View File

@ -14,6 +14,7 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include "storage_rocksdb.h"
#include <rocksdb/env.h>
#include <rocksdb/version.h>

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _ROCKSDBSTORAGE_H
#define _ROCKSDBSTORAGE_H
/*
@ -13,6 +14,7 @@
* Public License.
*/
#include <maxscale/cdefs.h>
#include "storage_rocksdb.h"
#include <memory>
#include <string>

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _STORAGE_ROCKSDB_H
#define _STORAGE_ROCKSDB_H
/*
@ -14,6 +15,7 @@
*/
#define MXS_MODULE_NAME "storage_rocksdb"
#include <maxscale/cdefs.h>
#include <maxscale/log_manager.h>
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _DBFWFILTER_H
#define _DBFWFILTER_H
/*
@ -20,8 +21,11 @@
* the generater parser which is created from the ruleparser.y and token.l files.
*/
#include <maxscale/cdefs.h>
#include <stdbool.h>
MXS_BEGIN_DECLS
/** Matching type */
enum match_type
{
@ -49,4 +53,6 @@ bool add_active_rule(void* scanner, const char* name);
void set_matching_mode(void* scanner, enum match_type mode);
bool create_user_templates(void* scanner);
MXS_END_DECLS
#endif

View File

@ -1,3 +1,4 @@
#pragma once
#ifndef _MYSQLHINT_H
#define _MYSQLHINT_H
/*
@ -19,8 +20,12 @@
* Date Who Description
* 17-07-2014 Mark Riddoch Initial implementation
*/
#include <maxscale/cdefs.h>
#include <maxscale/hint.h>
MXS_BEGIN_DECLS
/* Parser tokens for the hint parser */
typedef enum
{
@ -105,11 +110,10 @@ typedef struct
#define HS_PVALUE 5
#define HS_PREPARE 6
extern HINT *hint_parser(HINT_SESSION *session, GWBUF *request);
NAMEDHINTS* free_named_hint(NAMEDHINTS* named_hint);
HINTSTACK* free_hint_stack(HINTSTACK* hint_stack);
MXS_END_DECLS
#endif