Commit Graph

14 Commits

Author SHA1 Message Date
Lubomir Rintel
e69d386975 all: use the elvis operator wherever possible
Coccinelle:

  @@
  expression a, b;
  @@
  -a ? a : b
  +a ?: b

Applied with:

  spatch --sp-file ternary.cocci --in-place --smpl-spacing --dir .

With some manual adjustments on spots that Cocci didn't catch for
reasons unknown.

Thanks to the marvelous effort of the GNU compiler developer we can now
spare a couple of bits that could be used for more important things,
like this commit message. Standards commitees yet have to catch up.
2018-05-10 14:36:58 +02:00
Thomas Haller
8bace23beb all: cleanup includes and let "nm-default.h" include "config.h"
- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for <config.h> itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
2016-02-19 17:53:25 +01:00
Dan Winship
1cf35cb26b core: final gdbus porting
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.
2015-08-10 09:41:26 -04:00
Thomas Haller
19c3ea948a all: make use of new header file "nm-default.h" 2015-08-05 15:32:40 +02:00
Dan Winship
3452ee2a0e all: rename nm-glib-compat.h to nm-glib.h, use everywhere
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).
2015-07-24 13:25:47 -04:00
Thomas Haller
b835111129 libnm-util, core: fix warning about signed integer overflow (-Wstrict-overflow)
gcc warns:

    make[4]: Entering directory `./NetworkManager/libnm-util'
      CC       nm-value-transforms.lo
    nm-value-transforms.c: In function '_nm_utils_convert_op_array_to_string':
    nm-value-transforms.c:121:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (i > 0)
          ^
    nm-value-transforms.c: In function '_nm_utils_convert_string_array_to_string':
    nm-value-transforms.c:121:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (i > 0)
          ^

    make[7]: Entering directory `./NetworkManager/src/settings/plugins/ifcfg-rh'
      CC       reader.lo
    reader.c: In function 'make_wired_setting':
    reader.c:3295:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (!found)
          ^
    reader.c: In function 'wireless_connection_from_ifcfg':
    reader.c:3295:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (!found)
          ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 13:17:01 +02:00
Dan Winship
2570c5a17c libnm-util, libnm-glib: whitespace fixes
Fix indentation, kill trailing whitespace, split some long lines.
2014-07-15 09:44:55 -04:00
Dan Winship
cb7e1893e7 libnm-util, libnm-glib: standardize copyright/license headers
- Remove list of authors from files that had them; these serve no
  purpose except to quickly get out of date (and were only used in
  libnm-util and not libnm-glib anyway).

- Just say "Copyright", not "(C) Copyright" or "Copyright (C)"

- Put copyright statement after the license, not before

- Remove "NetworkManager - Network link manager" from the few files
  that contained it, and "libnm_glib -- Access network status &
  information from glib applications" from the many files that
  contained it.

- Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
  to files that were missing it.
2014-07-15 09:44:54 -04:00
Jiří Klimeš
1b55014468 libnm-util: don't append NULL in g_string_append() 2014-06-09 10:36:54 +02:00
Dan Winship
4c0ac46a99 libnm-util: add a missing GValue transform needed by nmtui 2014-01-16 09:19:06 -05:00
Thomas Haller
6f2cfe263e all: refactor to make use of nm_utils_inet[46]_ntop functions
https://bugzilla.gnome.org/show_bug.cgi?id=711684

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-09 17:21:22 +01:00
Pavel Šimerda
320a9d16a3 all: replace struct in_addr with guint32 2013-08-03 00:15:07 -05:00
Dan Winship
6ff924f82f libnm-utils: change the GValue transforms to match nmcli's outputs
That way, nmcli can use them...
2013-03-26 12:15:49 -04:00
Dan Winship
331b69bd90 libnm-util: split GValue transforms out of nm-utils.c
nm-utils.c is really big, so split the GValue transforms out into
their own file.
2013-03-26 12:15:49 -04:00