1. 21 Feb, 2019 1 commit
    • Thomas Haller's avatar
      shared/nm-glib: add our own g_steal_pointer() macro to shadow the one from glib · 6c07faa0
      Thomas Haller authored
      g_steal_pointer() as provided by glib improved significantly. Nowadays it
      casts the return type via the non-standard typeof() operator.
      
      But this useful feature is only enabled with
      
          GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58
      
      which NetworkManager does not set.
      
      This macro is hardly rocket science. Always provide our own
      implementation, that always does the casting (we rely on gcc/clang
      to support typeof() already at many places).
      6c07faa0
  2. 07 Jan, 2019 1 commit
  3. 18 Jul, 2018 1 commit
    • Thomas Haller's avatar
      shared/gsystem-local-alloc: merge "gsystem-local-alloc.h" into "nm-macros-shared.h" · e9d9fc3f
      Thomas Haller authored
      We only have a certain granularity of how our headers in "shared/nm-utils"
      can be used independently.
      
      For example, it's not supported to use "nm-macros-internal.h" without
      "gsystem-local-alloc.h". Likewise, you cannot use "nm-glib.h" directly,
      you always get it together with "nm-macros-internal.h".
      
      This is, we don't support to use certain headers entirely independently,
      because usually you anyway want to use them together.
      
      As such, no longer support "gsystem-local-alloc.h", but merge the
      remainder into "nm-macros-internal.h". There is really no reason
      to support arbitrary flexibility of including individual bits. You
      want cleanup-macros? Include "nm-macros-internal.h".
      
      Merge the headers.
      e9d9fc3f
  4. 11 Jul, 2018 1 commit
    • Thomas Haller's avatar
      all: don't use gchar/gshort/gint/glong but C types · e1c7a2b5
      Thomas Haller authored
      We commonly don't use the glib typedefs for char/short/int/long,
      but their C types directly.
      
          $ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          587
          $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          21114
      
      One could argue that using the glib typedefs is preferable in
      public API (of our glib based libnm library) or where it clearly
      is related to glib, like during
      
        g_object_set (obj, PROPERTY, (gint) value, NULL);
      
      However, that argument does not seem strong, because in practice we don't
      follow that argument today, and seldomly use the glib typedefs.
      Also, the style guide for this would be hard to formalize, because
      "using them where clearly related to a glib" is a very loose suggestion.
      
      Also note that glib typedefs will always just be typedefs of the
      underlying C types. There is no danger of glib changing the meaning
      of these typedefs (because that would be a major API break of glib).
      
      A simple style guide is instead: don't use these typedefs.
      
      No manual actions, I only ran the bash script:
      
        FILES=($(git ls-files '*.[hc]'))
        sed -i \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>  /\1   /g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \
            "${FILES[@]}"
      e1c7a2b5
  5. 09 Jul, 2018 3 commits
    • Thomas Haller's avatar
      shared: ensure "nm-glib.h" is not used without "nm-macros-internal.h" · bf593304
      Thomas Haller authored
      Note how "nm-glib.h" uses _nm_printf() macro, which is defined in
      "nm-macros-internal.h". There are many ways how to solve that
      problem.
      
      For example, we could define certain _nm_*() macros in "nm-glib.h"
      itself. However, that is a bit awkward, because optimally "nm-glib.h"
      only provides functions that are strictly related to glib compatiblity.
      _nm_printf() is used by "nm-glib.h" for its own implementation, it should
      not provide (or reimplement) this macro.
      
      We solve this instead by enforcing what NetworkManager already does.
      NetworkManager never includes "nm-glib.h" directly, instead
      "nm-macros-internal.h" is the only place that includes the glib compat
      header. It means, you cannot use "nm-glib.h" without
      "nm-macros-internal.h". But that is a reasonable compromise, with
      respect to granularity. The granularity at the moment is: if you use
      anything from "shared/nm-utils", you almost always need at least
      "nm-macros-internal.h" header (and automatically also get "nm-glib.h"
      and "gsystem-local-alloc.h"). It's not intended, to use "nm-glib.h"
      directly.
      
      This makes "nm-glib.h" an implementation detail of "nm-macros-internal.h"
      and it only exists to separate code that is related to glib compatibility to
      its own header.
      bf593304
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      shared: restore compat code in nm-glib.h for 2.32 compatibility · 56ddc890
      Thomas Haller authored
      In commit 8a46b25c, NetworkManager
      bumped its glib dependency to 2.40 or newer.
      
      "nm-glib.h" header is precisely the compatiblity implementation that we
      use to cope with older glib versions. Note, that the same implementation
      is also used by applet and VPN plugins.
      
      However, applet and VPN plugins don't yet require 2.40 glib. Also,
      they don't yet require NetworkManager 1.12.0 API (which was the one
      that bumped the glib requirement to 2.40). Hence, when "nm-glib.h"
      is used in applet or VPN, it must still cope with older versions,
      although, the code is not used by NetworkManager itself.
      
      Partly revert 8a46b25c so that nm-glib.h
      again works for 2.32 or newer.
      
      The same is true, also for "nm-test-utils.h", which is also used by
      applet and VPN plugins.
      56ddc890
  6. 30 Apr, 2018 1 commit
  7. 27 Mar, 2018 1 commit
  8. 18 Jan, 2018 1 commit
  9. 06 Dec, 2017 1 commit
  10. 18 Sep, 2017 1 commit
  11. 23 Feb, 2017 1 commit
  12. 06 Feb, 2017 1 commit
    • Thomas Haller's avatar
      shared: fix -Wtype-limits warning in nm_glib_check_version() macro · 1a190b90
      Thomas Haller authored
      Fix it by converting the macro to an inline function. It's anyway
      nicer.
      
          $ make src/src_libNetworkManagerBase_la-main-utils.lo
            CC       src/src_libNetworkManagerBase_la-main-utils.lo
          In file included from ./shared/nm-utils/nm-macros-internal.h:29:0,
                           from ./shared/nm-default.h:178,
                           from src/main-utils.c:22:
          src/main-utils.c: In function ‘nm_main_utils_setup_signals’:
          ./shared/nm-utils/nm-glib.h:144:36: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
                        && glib_micro_version >= (micro))))
                                              ^
          src/main-utils.c:82:6: note: in expansion of macro ‘nm_glib_check_version’
            if (nm_glib_check_version (2, 36, 0)) {
                ^~~~~~~~~~~~~~~~~~~~~
          cc1: all warnings being treated as errors
          Makefile:12312: recipe for target 'src/src_libNetworkManagerBase_la-main-utils.lo' failed
      1a190b90
  13. 11 Aug, 2016 2 commits
  14. 17 Jun, 2016 3 commits
  15. 16 Jun, 2016 2 commits
    • Thomas Haller's avatar
      shared: include "gsystem-local-alloc.h" from "nm-glib.h" · 037462e9
      Thomas Haller authored
      "nm-glib.h" is the most basic header, the one we cannot do without.
      ("nm-default.h", is already more generic, the one which every common
      source file in NetworkManager repository should include).
      
      Let "gsystem-local-alloc.h" be included by "nm-glib.h" and nowhere
      else.
      037462e9
    • Thomas Haller's avatar
      shared: move shared files to subdirectory "shared/nm-utils/" · 4b288136
      Thomas Haller authored
      The "shared" directory contains files that are possibly used by all components
      of NetworkManager repository.
      
      Some of these files are even copied as-is to other projects (VPN plugins, nm-applet)
      and used there without modification. Move those files to a separate directory.
      By moving them to a common directory, it is clearer that they belong
      together. Also, you can easier compare the copied versions to their
      original via
      
        $ diff -r ./shared/nm-utils/ /path/to/nm-vpn-plugin/shared/nm-utils/
      4b288136
  16. 12 May, 2016 1 commit
  17. 24 Feb, 2016 1 commit
  18. 11 Feb, 2016 1 commit
  19. 24 Dec, 2015 1 commit
    • Thomas Haller's avatar
      build: rename directory "include" to "shared" · db80ec05
      Thomas Haller authored
      Up to now, the "include" directory contained (only) header files that were
      used project-wide by libs, core, clients, et al.
      
      Since the directory now also contains a non-header file, the "include"
      name is misleading. Instead of adding yet another directory that is
      project-wide, with non-header-only content, rename the "include"
      directory to "shared".
      db80ec05
  20. 25 Nov, 2015 1 commit
  21. 01 Oct, 2015 1 commit
  22. 30 Sep, 2015 1 commit
  23. 10 Aug, 2015 2 commits
    • Dan Winship's avatar
      core: final gdbus porting · 1cf35cb2
      Dan Winship authored
      Port remaining bits to gdbus and remove stray dbus-glib references
      
      Drop the dbus-glib version check from configure, since nothing depends
      on new dbus-glib any more.
      
      Move nm-dbus-glib-types.h and nm-gvaluearray-compat.h from include/ to
      libnm-util/ since they are now only used by libnm-util and libnm-glib.
      1cf35cb2
    • Dan Winship's avatar
      core: port NMBusManager to gdbus · 4b823a86
      Dan Winship authored
      Also remove some now-unused NMBusManager API
      4b823a86
  24. 24 Jul, 2015 1 commit
    • Dan Winship's avatar
      all: rename nm-glib-compat.h to nm-glib.h, use everywhere · 3452ee2a
      Dan Winship authored
      Rather than randomly including one or more of <glib.h>,
      <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
      "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
      nm-glib.h, include <gio/gio.h> from there, and then change all .c
      files in NM to include "nm-glib.h" rather than including the glib
      headers directly.
      
      (Public headers files still have to include the real glib headers,
      since nm-glib.h isn't installed...)
      
      Also, remove glib includes from header files that are already
      including a base object header file (which must itself already include
      the glib headers).
      3452ee2a
  25. 12 Jul, 2015 1 commit
  26. 02 Jul, 2015 1 commit
  27. 22 Jun, 2015 1 commit
  28. 17 Jun, 2015 2 commits
  29. 12 Nov, 2014 1 commit
  30. 22 Oct, 2014 1 commit
    • Dan Winship's avatar
      libnm-core: add nm-errors.[ch] · b1bcfa8f
      Dan Winship authored
      Add nm-errors.[ch], and move libnm-core's two error domains
      (NMConnectionError and NMCryptoError) there.
      
      NMCryptoError wasn't previously visible, but it can be returned from
      some public API, so it should be.
      b1bcfa8f
  31. 25 Aug, 2014 1 commit
  32. 22 Aug, 2014 1 commit