1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
4 * This file is part of message-port.
6 * Copyright (C) 2013 Intel Corporation.
8 * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 #ifndef __MSGPORT_UTILS_H
27 #define __MSGPORT_UTILS_H
32 #define msgport_return_if_fail(expr) g_return_if_fail (expr)
33 #define msgport_return_if_fail_with_error(expr, err) \
35 if (G_LIKELY (expr)) { }\
37 g_return_if_fail_warning (G_LOG_DOMAIN,__PRETTY_FUNCTION__, ##expr);\
38 if (err) *err = msgport_error_new (MSGPORT_ERROR_INVALID_PARAMS, "assert("#expr")"); \
43 #define msgport_return_val_if_fail(expr, ret) g_return_val_if_fail (expr, ret)
44 #define msgport_return_val_if_fail_with_error(expr, ret, err) \
46 if (G_LIKELY(expr)) { } \
48 g_return_if_fail_warning (G_LOG_DOMAIN,__PRETTY_FUNCTION__, #expr);\
49 if (err) *err = msgport_error_new (MSGPORT_ERROR_INVALID_PARAMS, "assert("#expr")"); \
54 #endif /* __MSGPORT_UTILS_H */