Update codes for TIZEN 2.0
[apps/home/memo.git] / extend / gravel.h
1 /*
2 *
3 * Copyright 2012  Samsung Electronics Co., Ltd
4 *
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *    http://www.tizenopensource.org/license
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef __GRAVEL_H__
20 #define __GRAVEL_H__
21
22 #include <dlog.h>
23
24 /* use prefix 'P' means print */
25 #define PTAG LOGD("[%s : %d]\n", __FILE__, __LINE__)
26 #define PLOG(fmt, arg...) LOGD(" ## "fmt, ##arg)
27 #define PFUNC_ENTER LOGD("ENTER : %s\n", __func__)
28 #define PFUNC_LEAVE LOGD("LEAVE : %s\n", __func__)
29
30 #define ARRAY_SIZE(array) \
31         ((int)(sizeof(array) / sizeof(array[0])))
32
33 #define STR_EQUAL(str1, str2) \
34         (strcmp(str1, str2) == 0)
35
36 #define SSTRLEN(str)\
37         (str == NULL ? 0 : strlen(str))\
38
39 #define sncat(to, size, from) \
40         strncat(to, from, size-strlen(to)-1)
41
42 #define sncatprintf(s, size, fmt, args...) \
43         snprintf(s+strlen(s), size-strlen(s), fmt, ##args)
44
45 #define SMALLOC(Type)\
46         (Type *)calloc(1, sizeof(Type))\
47
48 #define SFREE(var)\
49         if (var != NULL) {\
50                 free(var);\
51                 var = NULL;\
52         } \
53
54 #define RETIF(condition)\
55         if (condition) return
56
57 #define RETVIF(condition, val)\
58         if (condition) return val
59
60 #endif                          /* __GRAVEL_H__ */