1f0bfeaa8Sopenharmony_ci/*
2f0bfeaa8Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3f0bfeaa8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4f0bfeaa8Sopenharmony_ci * you may not use this file except in compliance with the License.
5f0bfeaa8Sopenharmony_ci * You may obtain a copy of the License at
6f0bfeaa8Sopenharmony_ci *
7f0bfeaa8Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8f0bfeaa8Sopenharmony_ci *
9f0bfeaa8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10f0bfeaa8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11f0bfeaa8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12f0bfeaa8Sopenharmony_ci * See the License for the specific language governing permissions and
13f0bfeaa8Sopenharmony_ci * limitations under the License.
14f0bfeaa8Sopenharmony_ci */
15f0bfeaa8Sopenharmony_ci
16f0bfeaa8Sopenharmony_ci#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H
17f0bfeaa8Sopenharmony_ci#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H
18f0bfeaa8Sopenharmony_ci
19f0bfeaa8Sopenharmony_ci#include "hilog/log_c.h"
20f0bfeaa8Sopenharmony_ci
21f0bfeaa8Sopenharmony_ci#define IF_NULL_LOG_ACTION(pointer, log, action)       \
22f0bfeaa8Sopenharmony_ci    do {                                               \
23f0bfeaa8Sopenharmony_ci        if (!(pointer)) {                              \
24f0bfeaa8Sopenharmony_ci            HILOG_ERROR(LOG_CORE, "%{public}s:", log); \
25f0bfeaa8Sopenharmony_ci            action;                                    \
26f0bfeaa8Sopenharmony_ci        }                                              \
27f0bfeaa8Sopenharmony_ci    } while (0)
28f0bfeaa8Sopenharmony_ci
29f0bfeaa8Sopenharmony_ci#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H */
30