1. 23 10月, 2019 13 次提交
  2. 17 10月, 2019 3 次提交
  3. 14 10月, 2019 6 次提交
    • D
      util: replace strerror/strerror_r with g_strerror · c4d18e8b
      Daniel P. Berrangé 提交于
      g_strerror is offers the safety/correctness benefits of strerror_r, with
      the API design convenience of strerror.
      
      Use of virStrerror should be eliminated through the codebase in favour
      of g_strerror.
      
      commandhelper.c is a special case as its a tiny single threaded test
      program, not linked to glib, so it just uses traditional strerror().
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      c4d18e8b
    • D
      src: add support for g_autoptr with virObject instances · 667ff797
      Daniel P. Berrangé 提交于
      Libvirt currently uses the VIR_AUTOUNREF macro for auto cleanup of
      virObject instances. GLib approaches things differently with GObject,
      reusing their g_autoptr() concept.
      
      This introduces support for g_autoptr() with virObject, to facilitate
      the conversion to GObject.
      
      Only virObject classes which are currently used with VIR_AUTOREF are
      updated. Any others should be converted to GObject before introducing
      use of autocleanup.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      667ff797
    • D
      util: rewrite auto cleanup macros to use glib's equivalent · 44e7f029
      Daniel P. Berrangé 提交于
      To facilitate porting over to glib, this rewrites the auto cleanup
      macros to use glib's equivalent.
      
      As a result it is now possible to use g_autoptr/VIR_AUTOPTR, and
      g_auto/VIR_AUTOCLEAN, g_autofree/VIR_AUTOFREE interchangably, regardless
      of which macros were used to declare the cleanup types.
      
      Within the scope of any single method, code must remain consistent
      using either GLib or Libvirt macros, never mixing both. New code
      must preferentially use the GLib macros, and old code will be
      converted incrementally.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      44e7f029
    • D
      util: use glib string allocation/formatting functions · bb9a1a14
      Daniel P. Berrangé 提交于
      Convert the string duplication APIs to use the g_strdup family of APIs.
      
      We previously used the 'strdup-posix' gnulib module because mingw does
      not set errno to ENOMEM on failure
      
      We previously used the 'strndup' gnulib module because this function
      does not exist on mingw.
      
      We previously used the 'vasprintf' gnulib module because of many GNU
      supported format specifiers not working on non-Linux platforms. glib's
      own equivalent standardizes on GNU format specifiers too.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      bb9a1a14
    • D
      util: use glib memory allocation functions · e85e34f3
      Daniel P. Berrangé 提交于
      Convert the VIR_ALLOC family of APIs with use of the g_malloc family of
      APIs. Use of VIR_ALLOC related functions should be incrementally phased
      out over time, allowing return value checks to be dropped. Use of
      VIR_FREE should be replaced with auto-cleanup whenever possible.
      
      We previously used the 'calloc-posix' gnulib module because mingw does
      not set errno to ENOMEM on failure.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      e85e34f3
    • D
      build: link to glib library · cfbe9f12
      Daniel P. Berrangé 提交于
      Add the main glib.h to internal.h so that all common code can use it.
      
      Historically glib allowed applications to register an alternative
      memory allocator, so mixing g_malloc/g_free with malloc/free was not
      safe.
      
      This was feature was dropped in 2.46.0 with:
      
            commit 3be6ed60aa58095691bd697344765e715a327fc1
            Author: Alexander Larsson <alexl@redhat.com>
            Date:   Sat Jun 27 18:38:42 2015 +0200
      
              Deprecate and drop support for memory vtables
      
      Applications are still encourged to match g_malloc/g_free, but it is no
      longer a mandatory requirement for correctness, just stylistic. This is
      explicitly clarified in
      
          commit 1f24b36607bf708f037396014b2cdbc08d67b275
          Author: Daniel P. Berrangé <berrange@redhat.com>
          Date:   Thu Sep 5 14:37:54 2019 +0100
      
              gmem: clarify that g_malloc always uses the system allocator
      
      Applications can still use custom allocators in general, but they must
      do this by linking to a library that replaces the core malloc/free
      implemenentation entirely, instead of via a glib specific call.
      
      This means that libvirt does not need to be concerned about use of
      g_malloc/g_free causing an ABI change in the public libary, and can
      avoid memory copying when talking to external libraries.
      
      This patch probes for glib, which provides the foundation layer with
      a collection of data structures, helper APIs, and platform portability
      logic.
      
      Later patches will introduce linkage to gobject which provides the
      object type system, built on glib, and gio which providing objects
      for various interesting tasks, most notably including DBus client
      and server support and portable sockets APIs, but much more too.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      cfbe9f12
  4. 27 9月, 2019 1 次提交
  5. 14 8月, 2019 1 次提交
  6. 22 5月, 2019 3 次提交
  7. 15 3月, 2019 1 次提交
  8. 23 7月, 2018 2 次提交
    • A
      util: Improve virStrncpy() implementation · 7d70a63b
      Andrea Bolognani 提交于
      We finally get rid of the strncpy()-like semantics
      and implement our own, more sensible ones instead.
      
      As a bonus, this also fixes compilation on MinGW.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      7d70a63b
    • A
      src: Make virStr*cpy*() functions return an int · 6c0d0210
      Andrea Bolognani 提交于
      Currently, the functions return a pointer to the
      destination buffer on success or NULL on failure.
      
      Not only does this kind of error handling look quite
      alien in the context of libvirt, where most functions
      return zero on success and a negative int on failure,
      but it's also somewhat pointless because unless there's
      been a failure the returned pointer will be the same
      one passed in by the user, thus offering no additional
      value.
      
      Change the functions so that they return an int
      instead.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      6c0d0210
  9. 21 3月, 2018 1 次提交
  10. 09 2月, 2018 1 次提交
    • D
      docs: document requirement to provide Signed-off-by lines for DCO · d64d5ccb
      Daniel P. Berrange 提交于
      Document that contributors are required to assert compliance with the
      Developers Certification of Origin 1.1, by providing Signed-off-by tags
      for all commit messages. The DCO is formally stating what we have long
      implicitly expected of contributors in terms of their legal rights to
      make the contribution. This puts the project in a stronger position
      should any questions around contributions be raised going forward in the
      future.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d64d5ccb
  11. 16 10月, 2017 1 次提交
  12. 03 8月, 2017 2 次提交
  13. 26 6月, 2017 1 次提交
  14. 09 5月, 2017 1 次提交
  15. 10 3月, 2017 1 次提交
  16. 03 2月, 2017 1 次提交
    • A
      docs: Release notes should be updated in a separate commit · 54eaf639
      Andrea Bolognani 提交于
      Updating docs/news.xml in the same commit that performs the
      documented change makes backports needlessly complicated,
      both for mainteinance branches and downstream distributions,
      because it introduces additional potential for merge
      conflicts.
      
      Document in the contributor guidelines that the release notes
      should be updated in a separate commit instead, so that it's
      easy to backport just the code change.
      54eaf639
  17. 11 1月, 2017 1 次提交
    • A
      docs: Document the release notes process for contributors · 605e308c
      Andrea Bolognani 提交于
      Now that we have built a fairly solid process for dealing with
      release notes, we should start pushing for contributors to
      provide the relevant information along with their code:
      documenting the process is clearly a requirement for this to
      happen.
      605e308c