Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: clang format #55

Closed
2 changes: 1 addition & 1 deletion src/cmd_admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CmdConfig : public BaseCmdGroup {
bool DoInitial(PClient* client) override { return true; };

private:
// std::vector<std::string> subCmd_;
// std::vector<std::string> subCmd_;

void DoCmd(PClient* client) override{};
};
Expand Down
3 changes: 1 addition & 2 deletions src/cmd_table_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include "base_cmd.h"


namespace pikiwidb {

using CmdTable = std::unordered_map<std::string, std::unique_ptr<BaseCmd>>;
Expand All @@ -28,7 +27,7 @@ class CmdTableManager {

public:
void InitCmdTable();
std::pair<BaseCmd*,CmdRes::CmdRet> GetCommand(const std::string& cmdName, PClient* client);
std::pair<BaseCmd*, CmdRes::CmdRet> GetCommand(const std::string& cmdName, PClient* client);
// uint32_t DistributeKey(const std::string& key, uint32_t slot_num);
bool CmdExist(const std::string& cmd) const;
uint32_t GetCmdId();
Expand Down
4 changes: 2 additions & 2 deletions src/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

#include <map>
#include <vector>
#include "delegate.h"

#include "common.h"
#include "delegate.h"
#include "pstring.h"

namespace pikiwidb {
Expand Down Expand Up @@ -218,4 +219,3 @@ class PCommandTable {
};

} // namespace pikiwidb

3 changes: 2 additions & 1 deletion src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

#pragma once

#include <cstdio>
#include <strings.h>
#include <algorithm>
#include <cstddef>
#include <cstdio>
#include <functional>
#include <vector>

#include "pstring.h"

#define CRLF "\r\n"
Expand Down
1 change: 0 additions & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,3 @@ extern PConfig g_config;
extern bool LoadPikiwiDBConfig(const char* cfgFile, PConfig& cfg);

} // namespace pikiwidb

1 change: 0 additions & 1 deletion src/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@ class PDBLoader {
};

} // namespace pikiwidb

1 change: 0 additions & 1 deletion src/dump_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ class PDumpInterface {
};

} // namespace pikiwidb

1 change: 0 additions & 1 deletion src/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ using PHash = std::unordered_map<PString, PString, my_hash, std::equal_to<PStrin
size_t HScanKey(const PHash& hash, size_t cursor, size_t count, std::vector<PString>& res);

} // namespace pikiwidb

4 changes: 1 addition & 3 deletions src/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ inline typename HASH::const_iterator FollyRandomHashMember(const HASH& container
}

template <typename HASH>
inline size_t FollyScanHashMember(const HASH& container, size_t cursor, size_t count,
std::vector<PString>& res) {
inline size_t FollyScanHashMember(const HASH& container, size_t cursor, size_t count, std::vector<PString>& res) {
if (cursor >= container.size()) {
return 0;
}
Expand Down Expand Up @@ -166,4 +165,3 @@ extern std::vector<size_t> getMemoryInfo();
extern size_t getMemoryInfo(MemoryInfoType type);

} // namespace pikiwidb

2 changes: 1 addition & 1 deletion src/io_thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace pikiwidb {
class IOThreadPool {
public:
IOThreadPool() = default;
~IOThreadPool()= default;
~IOThreadPool() = default;

static const size_t GetMaxWorkerNum() { return kMaxWorkers; }

Expand Down
1 change: 0 additions & 1 deletion src/leveldb.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ class PLeveldb : public PDumpInterface {
};

} // namespace pikiwidb

1 change: 0 additions & 1 deletion src/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ enum class ListPosition {

using PList = std::list<PString>;
} // namespace pikiwidb

1 change: 0 additions & 1 deletion src/multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ class PMulti {
};

} // namespace pikiwidb

2 changes: 1 addition & 1 deletion src/net/config_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <vector>

#ifdef CONFIG_DEBUG
#include <iostream>
# include <iostream>
#endif

class ConfigParser {
Expand Down
9 changes: 2 additions & 7 deletions src/net/lzf/lzf.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@
* and lzf_c.c.
*
*/
unsigned int
lzf_compress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
unsigned int lzf_compress(const void *const in_data, unsigned int in_len, void *out_data, unsigned int out_len);

/*
* Decompress data compressed with some version of the lzf_compress
Expand All @@ -91,7 +89,4 @@ lzf_compress (const void *const in_data, unsigned int in_len,
*
* This function is very fast, about as fast as a copying loop.
*/
unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);

unsigned int lzf_decompress(const void *const in_data, unsigned int in_len, void *out_data, unsigned int out_len);
52 changes: 26 additions & 26 deletions src/net/lzf/lzfp.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#define STANDALONE 1 /* at the moment, this is ok. */

#ifndef STANDALONE
# include "lzf.h"
# include "lzf.h"
#endif

/*
Expand All @@ -51,7 +51,7 @@
* For best compression, use 15 or 16 (or more, up to 23).
*/
#ifndef HLOG
# define HLOG 16
# define HLOG 16
#endif

/*
Expand All @@ -60,7 +60,7 @@
* (very roughly) 15% faster. This is the preferred mode of operation.
*/
#ifndef VERY_FAST
# define VERY_FAST 1
# define VERY_FAST 1
#endif

/*
Expand All @@ -71,14 +71,14 @@
* possibly disable this for text data.
*/
#ifndef ULTRA_FAST
# define ULTRA_FAST 0
# define ULTRA_FAST 0
#endif

/*
* Unconditionally aligning does not cost very much, so do it if unsure
*/
#ifndef STRICT_ALIGN
# define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
# define STRICT_ALIGN !(defined(__i386) || defined(__amd64))
#endif

/*
Expand All @@ -87,7 +87,7 @@
* deterministic/repeatable when the configuration otherwise is the same).
*/
#ifndef INIT_HTAB
# define INIT_HTAB 0
# define INIT_HTAB 0
#endif

/*
Expand All @@ -96,7 +96,7 @@
* the documentation in lzf.h.
*/
#ifndef AVOID_ERRNO
# define AVOID_ERRNO 0
# define AVOID_ERRNO 0
#endif

/*
Expand All @@ -105,7 +105,7 @@
* NOTE: this breaks the prototype in lzf.h.
*/
#ifndef LZF_STATE_ARG
# define LZF_STATE_ARG 0
# define LZF_STATE_ARG 0
#endif

/*
Expand All @@ -117,7 +117,7 @@
* (<1% slowdown), but might slow down older cpus considerably.
*/
#ifndef CHECK_INPUT
# define CHECK_INPUT 1
# define CHECK_INPUT 1
#endif

/*****************************************************************************/
Expand All @@ -129,27 +129,27 @@ typedef const u8 *LZF_STATE[1 << (HLOG)];

#if !STRICT_ALIGN
/* for unaligned accesses we need a 16 bit datatype. */
# include <limits.h>
# if USHRT_MAX == 65535
typedef unsigned short u16;
# elif UINT_MAX == 65535
typedef unsigned int u16;
# else
# undef STRICT_ALIGN
# define STRICT_ALIGN 1
# endif
# include <limits.h>
# if USHRT_MAX == 65535
typedef unsigned short u16;
# elif UINT_MAX == 65535
typedef unsigned int u16;
# else
# undef STRICT_ALIGN
# define STRICT_ALIGN 1
# endif
#endif

#if ULTRA_FAST
# if defined(VERY_FAST)
# undef VERY_FAST
# endif
# if defined(VERY_FAST)
# undef VERY_FAST
# endif
#endif

#if INIT_HTAB
# ifdef __cplusplus
# include <cstring>
# else
# include <string.h>
# endif
# ifdef __cplusplus
# include <cstring>
# else
# include <string.h>
# endif
#endif
1 change: 0 additions & 1 deletion src/net/tcp_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,3 @@ inline std::shared_ptr<T> TcpConnection::GetContext() const {
}

} // namespace pikiwidb

2 changes: 0 additions & 2 deletions src/net/unbounded_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/


#pragma once

#include <cstring>
Expand Down Expand Up @@ -47,4 +46,3 @@ class UnboundedBuffer {
};

} // namespace pikiwidb

Loading