Fix macros 90/250590/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 30 Dec 2020 03:54:29 +0000 (12:54 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 30 Dec 2020 03:54:29 +0000 (12:54 +0900)
- Changes #ifndef macros to #undef
- Removes unused macros
- Removes calling fprintf() with stderr

Change-Id: I433930bfcef1a1f2b05f61fdc37094665c6c1505
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
include/appcore-internal.h
src/base/appcore_base_private.h
src/efl_base/appcore_efl_base_private.h
src/legacy/appcore-measure.c
src/legacy/appcore-rotation.c
src/multiwindow_base/appcore_multiwindow_base_private.h
src/ui_base/appcore_ui_base_private.h

index 87063ee..11268f2 100644 (file)
@@ -1,9 +1,5 @@
 /*
- *  app-core
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ * Copyright (c) 2000 - 2020 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.
  * 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 __APPCORE_INTERNAL_H__
 #define __APPCORE_INTERNAL_H__
 
-#define LOG_TAG "APP_CORE"
-
 #include <stdio.h>
 #include <stdbool.h>
 #include <dlog.h>
+
 #include "appcore-common.h"
 
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE"
+
+#undef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
+
+#undef _ERR
+#define _ERR LOGE
+
+#undef _INFO
+#define _INFO LOGI
 
-#ifndef EXPORT_API
-#  define EXPORT_API __attribute__ ((visibility("default")))
-#endif
-
-#ifndef _DLOG_H_
-#define _ERR(fmt, arg...) fprintf(stderr, "appcore: "fmt"\n", ##arg)
-#define _INFO(fmt, arg...) fprintf(stdout, fmt"\n", ##arg)
-#define _DBG(fmt, arg...) \
-       do { \
-               if (getenv("APPCORE_DEBUG")) { \
-                       fprintf(stdout, fmt"\n", ##arg); \
-               } \
-       } while (0)
-#else
-#define _ERR(fmt, arg...) LOGE(fmt, ##arg)
-#define _INFO(...) LOGI(__VA_ARGS__)
-#define _DBG(...) LOGD(__VA_ARGS__)
-#endif
-
-#define _warn_if(expr, fmt, arg...) do { \
-               if (expr) { \
-                       _ERR(fmt, ##arg); \
-               } \
-       } while (0)
-
-#define _ret_if(expr) do { \
-               if (expr) { \
-                       return; \
-               } \
-       } while (0)
-
-#define _retv_if(expr, val) do { \
-               if (expr) { \
-                       return (val); \
-               } \
-       } while (0)
-
-#define _retm_if(expr, fmt, arg...) do { \
-               if (expr) { \
-                       _ERR(fmt, ##arg); \
-                       return; \
-               } \
-       } while (0)
-
-#define _retvm_if(expr, val, fmt, arg...) do { \
-               if (expr) { \
-                       _ERR(fmt, ##arg); \
-                       return (val); \
-               } \
-       } while (0)
+#undef _DBG
+#define _DBG LOGD
 
 /**
  * Appcore internal state
index 003e747..e8df1be 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2016 - 2020 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.
@@ -16,8 +16,6 @@
 
 #pragma once
 
-#define LOG_TAG "APP_CORE_BASE"
-
 #include <stdio.h>
 #include <stdbool.h>
 #include <dlog.h>
@@ -31,70 +29,26 @@ typedef enum {
        TIZEN_PROFILE_COMMON = 0x10,
 } appcore_base_tizen_profile_t;
 
-#ifndef EXPORT_API
-#  define EXPORT_API __attribute__ ((visibility("default")))
-#endif
-
-#ifndef _DLOG_H_
-#  define _ERR(fmt, arg...) \
-       do { fprintf(stderr, "appcore: "fmt"\n", ##arg); } while (0)
-
-#  define _INFO(fmt, arg...) \
-       do { fprintf(stdout, fmt"\n", ##arg); } while (0)
-
-#  define _DBG(fmt, arg...) \
-       do { \
-               if (getenv("APPCORE_DEBUG")) { \
-                       fprintf(stdout, fmt"\n", ##arg); \
-               } \
-       } while (0)
-#else
-#  define _ERR(fmt, arg...) \
-       do { \
-               fprintf(stderr, "appcore: "fmt"\n", ##arg); \
-               LOGE(fmt, ##arg); \
-       } while (0)
-#  define _INFO(...) LOGI(__VA_ARGS__)
-#  define _DBG(...) LOGD(__VA_ARGS__)
-#endif
-
-#define _warn_if(expr, fmt, arg...) do { \
-               if (expr) { \
-                       _ERR(fmt, ##arg); \
-               } \
-       } while (0)
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE_BASE"
 
-#define _ret_if(expr) do { \
-               if (expr) { \
-                       return; \
-               } \
-       } while (0)
+#undef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
 
-#define _retv_if(expr, val) do { \
-               if (expr) { \
-                       return (val); \
-               } \
-       } while (0)
+#undef _ERR
+#define _ERR LOGE
 
-#define _retm_if(expr, fmt, arg...) do { \
-               if (expr) { \
-                       _ERR(fmt, ##arg); \
-                       return; \
-               } \
-       } while (0)
+#undef _INFO
+#define _INFO LOGI
 
-#define _retvm_if(expr, val, fmt, arg...) do { \
-               if (expr) { \
-                       _ERR(fmt, ##arg); \
-                       return (val); \
-               } \
-       } while (0)
+#undef _DBG
+#define _DBG LOGD
 
 appcore_base_tizen_profile_t appcore_base_get_tizen_profile(void);
 
-#define TIZEN_FEATURE_BACKGROUND_MANAGEMENT \
+#define TIZEN_FEATURE_BACKGROUND_MANAGEMENT                                    \
        (!(appcore_base_get_tizen_profile() & TIZEN_PROFILE_TV))
-#define TIZEN_FEATURE_CHARGER_STATUS \
+#define TIZEN_FEATURE_CHARGER_STATUS                                           \
        (appcore_base_get_tizen_profile() & TIZEN_PROFILE_WEARABLE)
 
 extern void aul_finalize();
index 2105107..7aee6cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 - 2020 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.
 
 #pragma once
 
-#define LOG_TAG "APP_CORE_EFL_BASE"
-
 #include <dlog.h>
 
-#ifndef EXPORT_API
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE_EFL_BASE"
+
+#undef EXPORT_API
 #define EXPORT_API __attribute__ ((visibility("default")))
-#endif
 
-#define _ERR(...) LOGE(__VA_ARGS__)
-#define _INFO(...) LOGI(__VA_ARGS__)
-#define _DBG(...) LOGD(__VA_ARGS__)
+#undef _ERR
+#define _ERR LOGE
+
+#undef _INFO
+#define _INFO LOGI
+
+#undef _DBG
+#define _DBG LOGD
index 62eed90..b37ab54 100644 (file)
@@ -32,7 +32,8 @@ static int __get_time(struct timeval *s)
 {
        struct timeval t;
 
-       _retv_if(s == NULL || (s->tv_sec == 0 && s->tv_usec == 0), 0);
+       if (s == NULL || (s->tv_sec == 0 && s->tv_usec == 0))
+               return 0;
 
        gettimeofday(&t, NULL);
 
@@ -45,14 +46,15 @@ static int __get_envtime(const char *name, struct timeval *t)
        char *s;
 
        s = getenv(name ? : ENV_START);
-       /*_retvm_if(s == NULL, -1, "%s is not set", name);*/
-       _retv_if(s == NULL, -1);
+       if (s == NULL)
+               return -1;
 
        r = sscanf(s, "%u/%u", (int *)&t->tv_sec, (int *)&t->tv_usec);
        if (r != 2)
                r = sscanf(s, "%u %u", (int *)&t->tv_sec, (int *)&t->tv_usec);
 
-       _retv_if(r != 2, -1);
+       if (r != 2)
+               return -1;
 
        return 0;
 }
@@ -66,7 +68,8 @@ static int __get_time_from(const char *name)
        gettimeofday(&t, NULL);
 
        r = __get_envtime(name, &s);
-       _retv_if(r == -1, 0);
+       if (r == -1)
+               return 0;
 
        return __get_msec(&s, &t);
 }
index e6e2bfd..0a6a9d7 100644 (file)
@@ -224,43 +224,43 @@ EXPORT_API int appcore_set_rotation_cb(int (*cb) (void *evnet_info, enum appcore
 
 EXPORT_API int appcore_unset_rotation_cb(void)
 {
+       bool r;
+
        if (rot.wm_rotate)
                return rot.wm_rotate->unset_rotation_cb();
-       else {
-               bool r;
 
-               _retv_if(rot.callback == NULL, 0);
+       if (rot.callback == NULL)
+               return 0;
 
-               __del_rotlock();
+       __del_rotlock();
 
-               if (rot.cb_set) {
-                       r = sensord_unregister_event(rot.handle,
-                                               AUTO_ROTATION_CHANGE_STATE_EVENT);
-                       if (!r) {
-                               _ERR("sensord_unregister_event failed");
-                               return -1;
-                       }
-                       rot.cb_set = 0;
-               }
-               rot.callback = NULL;
-               rot.cbdata = NULL;
-
-               if (rot.sensord_started == 1) {
-                       r = sensord_stop(rot.handle);
-                       if (!r) {
-                               _ERR("sensord_stop failed");
-                               return -1;
-                       }
-                       rot.sensord_started = 0;
+       if (rot.cb_set) {
+               r = sensord_unregister_event(rot.handle,
+                               AUTO_ROTATION_CHANGE_STATE_EVENT);
+               if (!r) {
+                       _ERR("sensord_unregister_event failed");
+                       return -1;
                }
+               rot.cb_set = 0;
+       }
+       rot.callback = NULL;
+       rot.cbdata = NULL;
 
-               r = sensord_disconnect(rot.handle);
+       if (rot.sensord_started == 1) {
+               r = sensord_stop(rot.handle);
                if (!r) {
-                       _ERR("sensord_disconnect failed");
+                       _ERR("sensord_stop failed");
                        return -1;
                }
-               rot.handle = -1;
+               rot.sensord_started = 0;
+       }
+
+       r = sensord_disconnect(rot.handle);
+       if (!r) {
+               _ERR("sensord_disconnect failed");
+               return -1;
        }
+       rot.handle = -1;
        return 0;
 }
 
index 9383e23..118610f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 - 2020 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.
 #include "appcore_base.h"
 #include "appcore_multiwindow_base.h"
 
-#ifndef EXPORT_API
-#  define EXPORT_API __attribute__ ((visibility("default")))
-#endif
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE_MULTIWINDOW_BASE"
+
+#undef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
 
-#ifndef _DLOG_H_
-#  define _ERR(fmt, arg...) \
-       do { fprintf(stderr, "appcore: "fmt"\n", ##arg); } while (0)
+#undef _ERR
+#define _ERR LOGE
 
-#  define _INFO(fmt, arg...) \
-       do { fprintf(stdout, fmt"\n", ##arg); } while (0)
+#undef _INFO
+#define _INFO LOGI
 
-#  define _DBG(fmt, arg...) \
-       do { \
-               if (getenv("APPCORE_DEBUG")) { \
-                       fprintf(stdout, fmt"\n", ##arg); \
-               } \
-       } while (0)
-#else
-#  define _ERR(fmt, arg...) \
-       do { \
-               fprintf(stderr, "appcore: "fmt"\n", ##arg); \
-               LOGE(fmt, ##arg); \
-       } while (0)
-#  define _INFO(...) LOGI(__VA_ARGS__)
-#  define _DBG(...) LOGD(__VA_ARGS__)
-#endif
+#undef _DBG
+#define _DBG LOGD
 
 typedef struct _appcore_multiwindow_base_context {
        appcore_multiwindow_base_ops ops;
index 0e8b2ae..010463b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2016 - 2020 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.
 
 #pragma once
 
-#define LOG_TAG "APP_CORE_UI_BASE"
-
-#include <stdio.h>
-#include <stdbool.h>
 #include <dlog.h>
 
-#ifndef EXPORT_API
-#  define EXPORT_API __attribute__ ((visibility("default")))
-#endif
-
-#ifndef _DLOG_H_
-#  define _ERR(fmt, arg...) \
-       do { fprintf(stderr, "appcore: "fmt"\n", ##arg); } while (0)
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE_UI_BASE"
 
-#  define _INFO(fmt, arg...) \
-       do { fprintf(stdout, fmt"\n", ##arg); } while (0)
+#undef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
 
-#  define _DBG(fmt, arg...) \
-       do { \
-               if (getenv("APPCORE_DEBUG")) { \
-                       fprintf(stdout, fmt"\n", ##arg); \
-               } \
-       } while (0)
-#else
-#  define _ERR(fmt, arg...) \
-       do { \
-               fprintf(stderr, "appcore: "fmt"\n", ##arg); \
-               LOGE(fmt, ##arg); \
-       } while (0)
-#  define _INFO(...) LOGI(__VA_ARGS__)
-#  define _DBG(...) LOGD(__VA_ARGS__)
-#endif
+#undef _ERR
+#define _ERR LOGE
 
+#undef _INFO
+#define _INFO LOGI
 
+#undef _DBG
+#define _DBG LOGD