Revert "edc: indicator paddings and scover code removed."
[apps/core/preloaded/indicator-win.git] / inc / common.h
1 /*
2  *  Indicator
3  *
4  * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20
21 #ifndef __DEF_common_H_
22 #define __DEF_common_H_
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <errno.h>
27
28 #define OK              (0)
29 #define FAIL    (-1)
30
31 #define LOG_TAG "INDICATOR"
32 #include <dlog.h>
33
34 #define ERR(str, args...)       LOGE("%s[%d]\t " #str "\n", \
35                                         __func__, __LINE__, ##args)
36 #define DBG(str, args...)       LOGD("%s[%d]\t " #str "\n", \
37                                         __func__, __LINE__, ##args)
38 #define INFO(str, args...)      LOGI(#str"\n", ##args)
39
40 #define SECURE_ERR(str, args...)        SECURE_LOGE("%s[%d]\t " #str "\n", \
41                                         __func__, __LINE__, ##args)
42 #define SECURE_DBG(str, args...)        SECURE_LOGD("%s[%d]\t " #str "\n", \
43                                         __func__, __LINE__, ##args)
44 #define SECURE_INFO(str, args...)       SECURE_LOGI(#str"\n", ##args)
45
46 #elif FILE_DEBUG /*_DLOG_USED*/
47 #include "indicator_debug_util.h"
48 #define ERR(str, args...)       debug_printf("%s[%d]\t " #str "\n", \
49                                         __func__, __LINE__, ##args)
50 #define DBG(str, args...)       debug_printf("%s[%d]\t " #str "\n", \
51                                         __func__, __LINE__, ##args)
52 #define INFO(str, args...)      debug_printf(#str"\n", ##args)
53 #else /*_DLOG_USED*/
54 #define ERR(str, args...)       fprintf(stderr, "%s[%d]\t " #str "\n",\
55                                         __func__, __LINE__, ##args)
56 #define DBG(str, args...)       fprintf(stderr, "%s[%d]\t " #str "\n",\
57                                         __func__, __LINE__, ##args)
58 #define INFO(str, args...)      fprintf(stderr, #str"\n", ##args)
59 #endif /*_DLOG_USED*/
60
61 #define retif(cond, ret, str, args...) do {\
62         if (cond) { \
63                 ERR(str, ##args);\
64                 return ret;\
65         } \
66 } while (0);
67 #define ECORE_FILE_MONITOR_DELIF(p) ({if (p) {ecore_file_monitor_del(p); p = NULL; }})
68
69 #define gotoif(cond, target, str, args...) do {\
70         if (cond) { \
71                 DBG(str, ##args);\
72                 goto target;\
73         } \
74 } while (0);