Improve:LedControl and Log include cleaner.
This commit is contained in:
parent
833b69a823
commit
67d5e2014f
|
@ -27,7 +27,7 @@ llvm-twine-local,\
|
|||
misc-confusable-identifiers,\
|
||||
misc-definitions-in-headers,\
|
||||
misc-header-include-cycle,\
|
||||
-misc-include-cleaner,\
|
||||
misc-include-cleaner,\
|
||||
misc-misleading-bidirectional,\
|
||||
misc-misleading-identifier,\
|
||||
misc-misplaced-const,\
|
||||
|
@ -55,7 +55,7 @@ set(CLANG_FORMAT_FILE "LLVM ${CMAKE_SOURCE_DIR_IPCSDK}/tools/clang-format/.clang
|
|||
if(${LINUX_TEST} MATCHES "true")
|
||||
set(CLANG_TIDY_SUPPORT "true")
|
||||
set(CLANG_FORMAT_SUPPORT "true")
|
||||
set(COMPILE_IMPROVE_SUPPORT "false") # 开启后每次编译可能会很慢
|
||||
set(COMPILE_IMPROVE_SUPPORT "true") # 开启后每次编译可能会很慢
|
||||
set(LLVM_PATH "$ENV{HOME}/llvm-project")
|
||||
endif()
|
||||
# ------------ build clang-tools end ------------ #
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
*/
|
||||
#include "LedControl.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
StatusCode VSingleControl::GetLedState(LedState &state)
|
||||
{
|
||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -13,21 +13,21 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "Log.h"
|
||||
#include "ILog.h"
|
||||
#include "ILogCpp.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
static void LogFree(ILog *object)
|
||||
{
|
||||
printf("log instance free.\n");
|
||||
if (object)
|
||||
{
|
||||
if (object) {
|
||||
free(object);
|
||||
}
|
||||
}
|
||||
static int LogPrintf(ILog *object, const char *function, const int line, const enum LogType type, const char *format, ...)
|
||||
static int LogPrintf(ILog *object, const char *function, const int line, const enum LogType type, const char *format,
|
||||
...)
|
||||
{
|
||||
// TODO:
|
||||
// LogTypeToString(type);
|
||||
|
@ -40,8 +40,7 @@ static int LogPrintf(ILog *object, const char *function, const int line, const e
|
|||
va_start(vargs, format);
|
||||
int len = vsnprintf(buff + headLen, SEND_TRACE_BUFF_SIZE - headLen, format, vargs);
|
||||
va_end(vargs);
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case LOG_TYPE_INFORMATION:
|
||||
ILogCpp::GetInstance()->InFo(buff);
|
||||
break;
|
||||
|
@ -75,16 +74,13 @@ static void LogImplInit(Log *log)
|
|||
}
|
||||
void NewLog(Log **log)
|
||||
{
|
||||
if (!log)
|
||||
{
|
||||
if (!log) {
|
||||
printf("STATUS_CODE_INVALID_PARAMENTER\n");
|
||||
return;
|
||||
}
|
||||
if (!(*log))
|
||||
{
|
||||
if (!(*log)) {
|
||||
*log = (Log *)malloc(sizeof(Log));
|
||||
if (*log)
|
||||
{
|
||||
if (*log) {
|
||||
printf("NewLog succeed.\n");
|
||||
NewILog((ILog **)log);
|
||||
LogImplInit(*log);
|
||||
|
|
Loading…
Reference in New Issue
Block a user