1 /* 2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_SHARING_COMMON_MARCO_H 17 #define OHOS_SHARING_COMMON_MARCO_H 18 19 namespace OHOS { 20 namespace Sharing { 21 #define RETURN_INVALID_IF(status) \ 22 do { \ 23 if (status) { \ 24 return -1; \ 25 } \ 26 } while (0) 27 28 #define RETURN_IF_NULL(pointer) \ 29 do { \ 30 if ((pointer) == nullptr) { \ 31 return; \ 32 } \ 33 } while (0) 34 35 #define RETURN_FALSE_IF_NULL(pointer) \ 36 do { \ 37 if ((pointer) == nullptr) { \ 38 return false; \ 39 } \ 40 } while (0) 41 42 #define RETURN_INVALID_IF_NULL(pointer) \ 43 do { \ 44 if ((pointer) == nullptr) { \ 45 return -1; \ 46 } \ 47 } while (0) 48 49 } // namespace Sharing 50 } // namespace OHOS 51 #endif