Blame src/libnm-glib-aux/nm-default-glib.h

Packit Service dff8e4
/* SPDX-License-Identifier: LGPL-2.1-or-later */
Packit Service dff8e4
/*
Packit Service dff8e4
 * Copyright (C) 2015 Red Hat, Inc.
Packit Service dff8e4
 */
Packit Service dff8e4
Packit Service dff8e4
#ifndef __NM_DEFAULT_GLIB_H__
Packit Service dff8e4
#define __NM_DEFAULT_GLIB_H__
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
#include "libnm-std-aux/nm-default-std.h"
Packit Service dff8e4
Packit Service dff8e4
#undef NETWORKMANAGER_COMPILATION
Packit Service dff8e4
#define NETWORKMANAGER_COMPILATION NM_NETWORKMANAGER_COMPILATION_WITH_GLIB
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
#include <glib.h>
Packit Service dff8e4
Packit Service dff8e4
#if defined(_NETWORKMANAGER_COMPILATION_GLIB_I18N_PROG)
Packit Service dff8e4
    #if defined(_NETWORKMANAGER_COMPILATION_GLIB_I18N_LIB)
Packit Service dff8e4
        #error Cannot define _NETWORKMANAGER_COMPILATION_GLIB_I18N_LIB and _NETWORKMANAGER_COMPILATION_GLIB_I18N_PROG together
Packit Service dff8e4
    #endif
Packit Service dff8e4
    #undef _NETWORKMANAGER_COMPILATION_GLIB_I18N_PROG
Packit Service dff8e4
    #include <glib/gi18n.h>
Packit Service dff8e4
#elif defined(_NETWORKMANAGER_COMPILATION_GLIB_I18N_LIB)
Packit Service dff8e4
    #undef _NETWORKMANAGER_COMPILATION_GLIB_I18N_LIB
Packit Service dff8e4
    #include <glib/gi18n-lib.h>
Packit Service dff8e4
#endif
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
#if NM_MORE_ASSERTS == 0
Packit Service dff8e4
    #ifndef G_DISABLE_CAST_CHECKS
Packit Service dff8e4
        /* Unless compiling with G_DISABLE_CAST_CHECKS, glib performs type checking
Packit Service dff8e4
         * during G_VARIANT_TYPE() via g_variant_type_checked_(). This is not necessary
Packit Service dff8e4
         * because commonly this cast is needed during something like
Packit Service dff8e4
         *
Packit Service dff8e4
         *   g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}"));
Packit Service dff8e4
         *
Packit Service dff8e4
         * Note that in if the variant type would be invalid, the check still
Packit Service dff8e4
         * wouldn't make the buggy code magically work. Instead of passing a
Packit Service dff8e4
         * bogus type string (bad), it would pass %NULL to g_variant_builder_init()
Packit Service dff8e4
         * (also bad).
Packit Service dff8e4
         *
Packit Service dff8e4
         * Also, a function like g_variant_builder_init() already validates
Packit Service dff8e4
         * the input type via something like
Packit Service dff8e4
         *
Packit Service dff8e4
         *   g_return_if_fail (g_variant_type_is_container (type));
Packit Service dff8e4
         *
Packit Service dff8e4
         * So, by having G_VARIANT_TYPE() also validate the type, we validate
Packit Service dff8e4
         * twice, whereas the first validation is rather pointless because it
Packit Service dff8e4
         * doesn't prevent the function to be called with invalid arguments.
Packit Service dff8e4
         *
Packit Service dff8e4
         * Just patch G_VARIANT_TYPE() to perform no check.
Packit Service dff8e4
         */
Packit Service dff8e4
        #undef G_VARIANT_TYPE
Packit Service dff8e4
        #define G_VARIANT_TYPE(type_string) ((const GVariantType *) (type_string))
Packit Service dff8e4
    #endif
Packit Service dff8e4
#endif
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
#include "nm-gassert-patch.h"
Packit Service dff8e4
Packit Service dff8e4
#include "libnm-std-aux/nm-std-aux.h"
Packit Service dff8e4
#include "libnm-std-aux/nm-std-utils.h"
Packit Service dff8e4
#include "libnm-glib-aux/nm-macros-internal.h"
Packit Service dff8e4
#include "libnm-glib-aux/nm-shared-utils.h"
Packit Service dff8e4
#include "libnm-glib-aux/nm-errno.h"
Packit Service dff8e4
#include "libnm-glib-aux/nm-hash-utils.h"
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
#endif /* __NM_DEFAULT_GLIB_H__ */