1. 04 Feb, 2021 1 commit
    • Philip Withnall's avatar
      glib: Use g_memdup2() instead of g_memdup() in obvious places · 0736b7c1
      Philip Withnall authored
      
      
      Convert all the call sites which use `g_memdup()`’s length argument
      trivially (for example, by passing a `sizeof()` or an existing `gsize`
      variable), so that they use `g_memdup2()` instead.
      
      In almost all of these cases the use of `g_memdup()` would not have
      caused problems, but it will soon be deprecated, so best port away from
      it
      
      In particular, this fixes an overflow within `g_bytes_new()`, identified
      as GHSL-2021-045 by GHSL team member Kevin Backhouse.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <pwithnall@endlessos.org>
      Fixes: GHSL-2021-045
      Helps: #2319
      0736b7c1
  2. 16 Oct, 2020 1 commit
  3. 23 Jul, 2020 1 commit
    • Nirbheek Chauhan's avatar
      glib: Use g_getenv everywhere instead of getenv · c3c2c313
      Nirbheek Chauhan authored
      `getenv()` doesn't work well on Windows, f.ex., it can't fetch env
      vars set with `SetEnvironmentVariable()`. This also means that it
      doesn't work at all when targeting UWP since that's the only way to
      set env vars in that case.
      c3c2c313
  4. 12 Jun, 2020 1 commit
    • Philip Withnall's avatar
      tree: Fix various typos and outdated terminology · 00bfb3ab
      Philip Withnall authored
      This was mostly machine generated with the following command:
      ```
      codespell \
          --builtin clear,rare,usage \
          --skip './po/*' --skip './.git/*' --skip './NEWS*' \
          --write-changes .
      ```
      using the latest git version of `codespell` as per [these
      instructions](https://github.com/codespell-project/codespell#user-content-updating
      
      ).
      
      Then I manually checked each change using `git add -p`, made a few
      manual fixups and dropped a load of incorrect changes.
      
      There are still some outdated or loaded terms used in GLib, mostly to do
      with git branch terminology. They will need to be changed later as part
      of a wider migration of git terminology.
      
      If I’ve missed anything, please file an issue!
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
      00bfb3ab
  5. 04 Mar, 2020 1 commit
  6. 29 Jul, 2019 1 commit
  7. 30 May, 2019 1 commit
  8. 03 Apr, 2019 1 commit
  9. 17 Mar, 2019 1 commit
    • Emmanuel Fleury's avatar
      Fixing signedness warning in glib/gslice.c · fad04d2e
      Emmanuel Fleury authored
      In file included from glib/glibconfig.h:9,
                       from glib/gslice.c:20:
      glib/gslice.c: In function ‘magazine_cache_trim’:
      glib/gmacros.h:354:25: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
       #define ABS(a)    (((a) < 0) ? -(a) : (a))
                               ^
      glib/gslice.c:643:10: note: in expansion of macro ‘ABS’
         while (ABS (stamp - magazine_chain_uint_stamp (current)) >= allocator->config.working_set_msecs)
                ^~~
      fad04d2e
  10. 07 Jan, 2019 1 commit
    • Philip Withnall's avatar
      gthread: Add g_private_set_alloc0() internal convenience API · f6caeb6d
      Philip Withnall authored
      
      
      This is a wrapper around g_private_set() which allocates the desired
      amount of memory for the caller and calls g_private_set() on it.
      
      This is intended to make it easier to suppress Valgrind warnings about
      leaked memory, since g_private_set() is typically used to make one-time
      per-thread allocations. We can now just add a blanket suppression rule
      for any allocations inside g_private_set_alloc0().
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
      f6caeb6d
  11. 31 May, 2018 1 commit
  12. 28 May, 2018 1 commit
    • Xavier Claessens's avatar
      Fix Windows build errors in valgrind.h · 707106c7
      Xavier Claessens authored
      valgrind.h is a verbatim copy taken from Valgrind project. Previously
      that file had local changes that got dropped by last update. To avoid
      regressing again, do not edit valgrind.h anymore and instead add a
      gvalgrind.h wrapper that gets included instead.
      
      This fix 2 errors:
      - uintptr_t is not defined when including valgrind.h on mingw.
      - MSVC compiler is not supported on amd64-Win64 platform.
      707106c7
  13. 26 May, 2018 1 commit
  14. 25 Apr, 2018 1 commit
  15. 12 Nov, 2017 1 commit
  16. 11 Oct, 2017 1 commit
  17. 03 Aug, 2017 2 commits
    • Philip Withnall's avatar
      gslice: Fix inline delarations in GSlice · 96528396
      Philip Withnall authored
      Accidentally introduced in commit
      5cddde1f
      
      .
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
      96528396
    • Philip Withnall's avatar
      Consistently save errno immediately after the operation setting it · 5cddde1f
      Philip Withnall authored
      Prevent the situation where errno is set by function A, then function B
      is called (which is typically _(), but could be anything else) and it
      overwrites errno, then errno is checked by the caller.
      
      errno is a horrific API, and we need to be careful to save its value as
      soon as a function call (which might set it) returns. i.e. Follow the
      pattern:
        int errsv, ret;
        ret = some_call_which_might_set_errno ();
        errsv = errno;
      
        if (ret < 0)
          puts (strerror (errsv));
      
      This patch implements that pattern throughout GLib. There might be a few
      places in the test code which still use errno directly. They should be
      ported as necessary. It doesn’t modify all the call sites like this:
        if (some_call_which_might_set_errno () && errno == ESOMETHING)
      since the refactoring involved is probably more harmful than beneficial
      there. It does, however, refactor other call sites regardless of whether
      they were originally buggy.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=785577
      5cddde1f
  18. 24 May, 2017 1 commit
    • Sébastien Wilmet's avatar
      glib/: LGPLv2+ -> LGPLv2.1+ · f9faac76
      Sébastien Wilmet authored
      All glib/*.{c,h} files have been processed, as well as gtester-report.
      
      12 of those files are not licensed under LGPL:
      
      	gbsearcharray.h
      	gconstructor.h
      	glibintl.h
      	gmirroringtable.h
      	gscripttable.h
      	gtranslit-data.h
      	gunibreak.h
      	gunichartables.h
      	gunicomp.h
      	gunidecomp.h
      	valgrind.h
      	win_iconv.c
      
      Some of them are generated files, some are licensed under a BSD-style
      license and win_iconv.c is in the public domain.
      
      Sub-directories inside glib/:
      
      	deprecated/: processed in a previous commit
      	glib-mirroring-tab/: already LGPLv2.1+
      	gnulib/: not modified, the code is copied from gnulib
      	libcharset/: a copy
      	pcre/: a copy
      	tests/: processed in a previous commit
      
      https://bugzilla.gnome.org/show_bug.cgi?id=776504
      f9faac76
  19. 07 Nov, 2015 1 commit
    • Philip Withnall's avatar
      glib: Add missing (nullable) and (optional) annotations · 25a7c817
      Philip Withnall authored
      Add various (nullable) and (optional) annotations which were missing
      from a variety of functions. Also port a couple of existing (allow-none)
      annotations in the same files to use (nullable) and (optional) as
      appropriate instead.
      
      Secondly, add various (not nullable) annotations as needed by the new
      default in gobject-introspection of marking gpointers as (nullable). See
      https://bugzilla.gnome.org/show_bug.cgi?id=729660.
      
      This includes adding some stub documentation comments for the
      assertion macro error functions, which weren’t previously documented.
      The new comments are purely to allow for annotations, and hence are
      marked as (skip) to prevent the symbols appearing in the GIR file.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=719966
      25a7c817
  20. 16 Apr, 2014 2 commits
  21. 15 Feb, 2014 1 commit
    • Matthias Clasen's avatar
      docs: let go of &ast; · bc6ee788
      Matthias Clasen authored
      Since we are no longer using sgml mode, using /&ast; &ast;/ to
      escape block comments inside examples does not work anymore.
      Switch to using line comments with //
      bc6ee788
  22. 08 Feb, 2014 1 commit
  23. 06 Feb, 2014 2 commits
  24. 01 Feb, 2014 2 commits
  25. 31 Jan, 2014 2 commits
  26. 20 Nov, 2013 2 commits
    • Dan Winship's avatar
      Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX · 158dde05
      Dan Winship authored
      In Windows development environments that have it, <unistd.h> is mostly
      just a wrapper around several other native headers (in particular,
      <io.h>, which contains read(), close(), etc, and <process.h>, which
      contains getpid()). But given that some Windows dev environments don't
      have <unistd.h>, everything that uses those functions on Windows
      already needed to include the correct Windows header as well, and so
      there is never any point to including <unistd.h> on Windows.
      
      Also, remove some <unistd.h> includes (and a few others) that were
      unnecessary even on unix.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=710519
      158dde05
    • Dan Winship's avatar
      Require C90 compliance · 6e4a7fca
      Dan Winship authored
      Assume all supported platforms implement C90, and therefore they
      (correctly) implement atexit(), memmove(), setlocale(), strerror(),
      and vprintf(), and have <float.h> and <limits.h>.
      
      (Also remove the configure check testing that "do ... while (0)" works
      correctly; the non-do/while-based version of G_STMT_START and
      G_STMT_END was removed years ago, but the check remained. Also, remove
      some checks that configure.ac claimed were needed for libcharset, but
      aren't actually used.)
      
      Note that removing the g_memmove() function is not an ABI break even
      on systems where g_memmove() was previously not a macro, because it
      was never marked GLIB_AVAILABLE_IN_ALL or listed in glib.symbols, so
      it would have been glib-internal since 2004.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=710519
      6e4a7fca
  27. 06 Nov, 2013 1 commit
  28. 22 Apr, 2013 1 commit
    • Allison Karlitskaya's avatar
      gslice: disable by default under valgrind · 00fbc2f0
      Allison Karlitskaya authored
      All experienced GLib hackers know that G_SLICE=always-malloc is
      absolutely essential when valgrinding but many users of GLib don't know
      about this and get hit pretty hard when valgrinding their programs.
      
      When initialising gslice, add a check to see if we are running under
      valgrind and disable ourselves if we are.
      
      We only do the check in the case that G_SLICE= was not specified in the
      environment, so setting it to an empty string will prevent this default
      behaviour.
      
      I considered modifying gslice to use the VALGRIND_MALLOCLIKE_BLOCK
      client request in all cases in order to just mark the blocks properly
      but these calls are not free and gslice is pretty hyper-optimised.  It's
      easier to just disable gslice completely and this way we only have to do
      one check during startup.  It's also theoretically possible that someone
      might want to use valgrind to debug gslice, in which case the extra
      annotations would probably cause quite a lot of difficulty.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=698595
      00fbc2f0
  29. 28 Jan, 2012 1 commit
  30. 15 Nov, 2011 1 commit
  31. 13 Nov, 2011 1 commit
  32. 16 Oct, 2011 1 commit
  33. 15 Oct, 2011 1 commit
  34. 04 Oct, 2011 1 commit
    • Allison Karlitskaya's avatar
      gslice: stop using ctors · 5bfb64d5
      Allison Karlitskaya authored
      We can't initialise gslice from a ctor because g_slice_set_config() must
      be called before gslice initialisation.
      
      Instead, do the initialisation in a threadsafe way from the
      initialisation function for the thread private data.  This will only be
      called once per thread so the synchronisation doesn't pose a significant
      overhead here.
      
      Ensure that we try to grab the thread private data directly on entrance
      to g_slice_alloc() so that we force the initialisation to occur.
      Grabbing the private data is the common case anyway.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=660887
      5bfb64d5