1. 17 10月, 2019 1 次提交
  2. 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
  3. 27 9月, 2019 1 次提交
  4. 14 8月, 2019 1 次提交
  5. 22 5月, 2019 3 次提交
  6. 15 3月, 2019 1 次提交
  7. 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
  8. 21 3月, 2018 1 次提交
  9. 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
  10. 16 10月, 2017 1 次提交
  11. 03 8月, 2017 2 次提交
  12. 26 6月, 2017 1 次提交
  13. 09 5月, 2017 1 次提交
  14. 10 3月, 2017 1 次提交
  15. 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
  16. 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
  17. 04 1月, 2017 2 次提交
    • A
      HACKING: Regenerate · d39e3b71
      Andrea Bolognani 提交于
      When updating the source file in commit bd4f4d16, I forgot
      that we also store the generated plain text version in git and
      didn't regenerate it.
      
      I also missed one spot that required an additional <p> tag, so
      fix both mistakes in one go.
      d39e3b71
    • A
      docs: Add missing <p> elements · bd4f4d16
      Andrea Bolognani 提交于
      Some of the <li> elements in the "General tips for contributing
      patches" section were missing the corresponding inner <p> element,
      so they ended up all lumped together.
      bd4f4d16
  18. 02 7月, 2016 1 次提交
  19. 14 5月, 2016 1 次提交
    • M
      virtestmock: Print invalid file accesses into a file · 6326865e
      Michal Privoznik 提交于
      All the accesses to files outside our build or source directories
      are now identified and appended into a file for later processing.
      The location of the file that contains all the records can be
      controlled via VIR_TEST_FILE_ACCESS env variable and defaults to
      abs_builddir "/test_file_access.txt".
      
      The script that will process the access file is to be added in
      next commit.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      6326865e
  20. 11 6月, 2015 1 次提交
  21. 24 4月, 2015 1 次提交
    • C
      tests: Add VIR_TEST_REGENERATE_OUTPUT · edb27a70
      Cole Robinson 提交于
      If this enviroment variable is set, the virTestCompareToFile helper
      will overwrite the file content we are comparing against, if the
      file doesn't exist or it doesn't match the expected input.
      
      This is useful when adding new test cases, or making changes that
      generate a lot of output churn.
      edb27a70
  22. 10 12月, 2014 1 次提交
  23. 08 12月, 2014 1 次提交
  24. 15 11月, 2014 1 次提交
  25. 22 10月, 2014 1 次提交
  26. 21 10月, 2014 1 次提交
  27. 05 9月, 2014 1 次提交
    • E
      maint: tighten curly brace syntax checking · bc7e63d3
      Eric Blake 提交于
      Now that hanging brace offenders have been fixed, we can automate
      the check, and document our style.  Done as a separate commit from
      code changes, to make it easier to just backport code changes, if
      that is ever needed.
      
      * cfg.mk (sc_curly_braces_style): Catch hanging braces.
      * docs/hacking.html.in: Document it.
      * HACKING: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      bc7e63d3
  28. 22 8月, 2014 1 次提交
  29. 05 7月, 2014 1 次提交
  30. 03 7月, 2014 1 次提交
    • J
      Introduce virBufferCheckError · 058d89b9
      Ján Tomko 提交于
      Check if the buffer is in error state and report an error if it is.
      
      This replaces the pattern:
      if (virBufferError(buf)) {
          virReportOOMError();
          goto cleanup;
      }
      with:
      
      if (virBufferCheckError(buf) < 0)
          goto cleanup;
      
      Document typical buffer usage to favor this.
      Also remove the redundant FreeAndReset - if an error has
      been set via virBufferSetError, the content is already freed.
      058d89b9