1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* Indicator
*
* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef __DEF_common_H_
#define __DEF_common_H_
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#define OK (0)
#define FAIL (-1)
#define LOG_TAG "INDICATOR"
#include <dlog.h>
#define ERR(str, args...) LOGE("%s[%d]\t " #str "\n", \
__func__, __LINE__, ##args)
#define DBG(str, args...) LOGD("%s[%d]\t " #str "\n", \
__func__, __LINE__, ##args)
#define INFO(str, args...) LOGI(#str"\n", ##args)
#define SECURE_ERR(str, args...) SECURE_LOGE("%s[%d]\t " #str "\n", \
__func__, __LINE__, ##args)
#define SECURE_DBG(str, args...) SECURE_LOGD("%s[%d]\t " #str "\n", \
__func__, __LINE__, ##args)
#define SECURE_INFO(str, args...) SECURE_LOGI(#str"\n", ##args)
#elif FILE_DEBUG /*_DLOG_USED*/
#include "indicator_debug_util.h"
#define ERR(str, args...) debug_printf("%s[%d]\t " #str "\n", \
__func__, __LINE__, ##args)
#define DBG(str, args...) debug_printf("%s[%d]\t " #str "\n", \
__func__, __LINE__, ##args)
#define INFO(str, args...) debug_printf(#str"\n", ##args)
#else /*_DLOG_USED*/
#define ERR(str, args...) fprintf(stderr, "%s[%d]\t " #str "\n",\
__func__, __LINE__, ##args)
#define DBG(str, args...) fprintf(stderr, "%s[%d]\t " #str "\n",\
__func__, __LINE__, ##args)
#define INFO(str, args...) fprintf(stderr, #str"\n", ##args)
#endif /*_DLOG_USED*/
#define retif(cond, ret, str, args...) do {\
if (cond) { \
ERR(str, ##args);\
return ret;\
} \
} while (0);
#define ECORE_FILE_MONITOR_DELIF(p) ({if (p) {ecore_file_monitor_del(p); p = NULL; }})
#define gotoif(cond, target, str, args...) do {\
if (cond) { \
DBG(str, ##args);\
goto target;\
} \
} while (0);
|