From 1b79ebf2328a13ee9ac1474bc96c6e223691cb5f Mon Sep 17 00:00:00 2001 From: Feng Date: Thu, 11 Feb 2016 14:33:06 +0800 Subject: [PATCH] 0.16.0 - fix format/comments, add PROC_NAME/2 macro --- include/emqttd.hrl | 10 +++++----- include/emqttd_cli.hrl | 12 ++++-------- include/emqttd_internal.hrl | 8 +++++--- include/emqttd_protocol.hrl | 3 +-- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/include/emqttd.hrl b/include/emqttd.hrl index 661deefd2..e0349d57f 100644 --- a/include/emqttd.hrl +++ b/include/emqttd.hrl @@ -14,7 +14,7 @@ %% limitations under the License. %%-------------------------------------------------------------------- -%% @doc MQTT Broker Header. +%% MQTT Broker Header %%-------------------------------------------------------------------- %% Banner @@ -22,7 +22,7 @@ -define(COPYRIGHT, "Copyright (C) 2012-2016, Feng Lee "). --define(LICENSE_MESSAGE, "Licensed under MIT"). +-define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0"). -define(PROTOCOL_VERSION, "MQTT/3.1.1"). @@ -56,9 +56,9 @@ %% MQTT Subscription %%-------------------------------------------------------------------- -record(mqtt_subscription, { - subid :: binary() | atom(), - topic :: binary(), - qos = 0 :: 0 | 1 | 2 + subid :: binary() | atom(), + topic :: binary(), + qos = 0 :: 0 | 1 | 2 }). -type mqtt_subscription() :: #mqtt_subscription{}. diff --git a/include/emqttd_cli.hrl b/include/emqttd_cli.hrl index e2c27e779..620a771e2 100644 --- a/include/emqttd_cli.hrl +++ b/include/emqttd_cli.hrl @@ -14,15 +14,11 @@ %% limitations under the License. %%-------------------------------------------------------------------- --define(PRINT(Format, Args), - io:format(Format, Args)). +-define(PRINT_MSG(Msg), io:format(Msg)). --define(PRINT_MSG(Msg), - io:format(Msg)). +-define(PRINT(Format, Args), io:format(Format, Args)). --define(PRINT_CMD(Cmd, Descr), - io:format("~-40s#~s~n", [Cmd, Descr])). +-define(PRINT_CMD(Cmd, Descr), io:format("~-40s#~s~n", [Cmd, Descr])). --define(USAGE(CmdList), - [?PRINT_CMD(Cmd, Descr) || {Cmd, Descr} <- CmdList]). +-define(USAGE(CmdList), [?PRINT_CMD(Cmd, Descr) || {Cmd, Descr} <- CmdList]). diff --git a/include/emqttd_internal.hrl b/include/emqttd_internal.hrl index 6ed9d83d8..5b4f6189d 100644 --- a/include/emqttd_internal.hrl +++ b/include/emqttd_internal.hrl @@ -14,7 +14,7 @@ %% limitations under the License. %%-------------------------------------------------------------------- -%% @doc Internal Header File +%% Internal Header File -define(GPROC_POOL(JoinOrLeave, Pool, I), (begin @@ -24,6 +24,8 @@ end end)). +-define(PROC_NAME(M, I), (list_to_atom(lists:concat([M, "_", I])))). + -define(record_to_proplist(Def, Rec), lists:zip(record_info(fields, Def), tl(tuple_to_list(Rec)))). @@ -52,7 +54,7 @@ -define(IF(Cond, TrueFun,FalseFun), (case (Cond) of - true ->(TrueCase); - false->(FalseCase) + true -> (TrueFun); + false-> (FalseFun) end)). diff --git a/include/emqttd_protocol.hrl b/include/emqttd_protocol.hrl index 44b1af25d..61b82f02d 100644 --- a/include/emqttd_protocol.hrl +++ b/include/emqttd_protocol.hrl @@ -14,7 +14,7 @@ %% limitations under the License. %%-------------------------------------------------------------------- -%% @doc MQTT Protocol Header. +%% MQTT Protocol Header %%-------------------------------------------------------------------- %% MQTT Protocol Version and Levels @@ -62,7 +62,6 @@ end) end). - %%-------------------------------------------------------------------- %% Max ClientId Length. Why 1024? NiDongDe... %%--------------------------------------------------------------------