1. 20 Jun, 2019 15 commits
  2. 17 Jun, 2019 5 commits
  3. 10 Jun, 2019 1 commit
    • Stéphane Seng's avatar
      arg: Fix the marshalling of GPtrArrays by ensuring that their elements are... · 3a5e42db
      Stéphane Seng authored
      arg: Fix the marshalling of GPtrArrays by ensuring that their elements are considered as pointers instead of structures
      
      When marshalling GPtrArrays of GI_INFO_TYPE_STRUCT such as NMIPAddress,
      GPtrArrays are considered as arrays of structures instead of arrays of
      pointers, with both `info_type == GI_INFO_TYPE_STRUCT` and
      `!g_type_info_is_pointer(param_info)` being `true`.
      
      One way of fixing this issue is to consider the array type in
      `gjs_array_from_carray_internal()` so that we can avoid treating array elements
      as structures instead of pointers when the array is a `GPtrArray`.
      
      Unfortunately it does not look like tests can easily be added to cover this
      fix, without having to add new functions in
      https://gitlab.gnome.org/GNOME/gobject-introspection/blob/1.60.1/tests/gimarshallingtests.c.
      
      Closes #9.
      3a5e42db
  4. 09 Jun, 2019 19 commits
    • Cosimo Cecchi's avatar
      Merge branch 'may-maintenance' into 'master' · ab56b15d
      Cosimo Cecchi authored
      May maintenance
      
      See merge request !301
      ab56b15d
    • Philip Chimento's avatar
      maint: Fix cppcheck suppression comment · 57abf313
      Philip Chimento authored
      Not sure why this didn't trip on master before.
      57abf313
    • Philip Chimento's avatar
      maint: Remove cpplint exception from util/sp-capture-* · 9e9b078b
      Philip Chimento authored
      These files no longer exist, we have an internal dependency on
      libsysprof-capture instead. We no longer need to exclude them from
      linting.
      9e9b078b
    • Philip Chimento's avatar
      maint: Add cpplint exception · 1fc32882
      Philip Chimento authored
      This rule exists because Chromium doesn't want certain C++ standard
      library features in their codebase since they have implemented their own
      alternatives. This rule shouldn't apply to codebases that aren't
      Chromium.
      1fc32882
    • Philip Chimento's avatar
      global: Lazy-define standard environment · efc297c0
      Philip Chimento authored
      In SpiderMonkey 68, using lazy-define for the standard global properties
      will be the only option, since JS_InitStandardClasses() will go away.
      This should not change anything, only that global properties such as
      String and Number will be defined on demand instead of in advance.
      efc297c0
    • Philip Chimento's avatar
      context: Destroy atoms before destroying context · dd8efa26
      Philip Chimento authored
      In SpiderMonkey 68, the destructor of JS::Heap<jsid> can no longer be
      run after the context has shut down. So it seems to be good practice to
      decouple the lifetime of GjsAtoms (which contains JS::Heap<jsid>) from
      that of the GjsContext.
      dd8efa26
    • Philip Chimento's avatar
      js: Avoid unnecessary gjs_string_to_utf8() · d0c07a37
      Philip Chimento authored
      gjs_string_to_utf8(..., JS::StringValue(...), ...) is a pattern to be
      avoided, because gjs_string_to_utf8() just checks value.isString() and
      calls value.toString() before calling JS_EncodeStringToUTF8(). Instead,
      use JS_EncodeStringToUTF8() directly, to avoid the unnecessary creation
      of JS::Value.
      d0c07a37
    • Philip Chimento's avatar
      maint: Use C++ attributes where available · b2e1a39d
      Philip Chimento authored
      The attributes available in C++14 are [[noreturn]],
      [[carries_dependency]], and [[deprecated()]]. We can use these built-in
      attributes instead of relying on the platform-specific defines in GLib.
      
      It would be nice to be able to use future attributes such as
      [[fallthrough]] and let them take effect as compilers implement them; or
      use custom attributes such as [[gjs::jsapi_return_convention]]; but in
      C++14, unknown attributes are not yet guaranteed to be ignored. That
      happens in C++17.
      b2e1a39d
    • Philip Chimento's avatar
      maint: Fix header includes once and for all · 01920362
      Philip Chimento authored
      Previously #include statements were a bit of a mess across the codebase.
      This commit is the result of a pass by the IWYU (Include What You Use)
      tool, which suggests headers to add or remove based on what is in the
      file, and can also suggest forward-declaring classes instead of
      including their headers, if they are only used as a pointer in a
      particular file. Cleaning this up should in general speed up compile
      times.
      
      IWYU isn't perfect, it produces a number of false positives, so we don't
      try to automate this process and we don't accept all of its
      recommendations. We do add a script and configuration file to the tools/
      directory so that IWYU can be every so often in the future.
      
      We also clean up all the includes according to a consistent style, which
      is now described clearly in the C++ style guide.
      01920362
    • Philip Chimento's avatar
      util: Move util/error to gjs/error-types · e9d108c4
      Philip Chimento authored
      This is not really a utility file, it's part of the GJS public API, so
      it should go in gjs/ and its header file should be installed in the
      normal $pkgincludedir/gjs location; #include <util/error.h> isn't
      namespaced and might be provided by any number of libraries.
      e9d108c4
    • Philip Chimento's avatar
      util: Remove util/glib · 1f96eb4b
      Philip Chimento authored
      This file only had one function in it. It's not clear why this util file
      is "glib" and the other file with one function in it is "misc". Merge
      them both into "misc".
      1f96eb4b
    • Philip Chimento's avatar
      maint: Remove G_BEGIN_DECLS and G_END_DECLS from internal files · a759d514
      Philip Chimento authored
      Any C++ header files that are internal to GJS that don't need to be
      introspected, don't have to use G_BEGIN_DECLS and G_END_DECLS. It
      doesn't matter whether their symbols are mangled or not.
      a759d514
    • Philip Chimento's avatar
      maint: Unify header guard style across all headers · 494dc062
      Philip Chimento authored
      We have a number of different header guard styles in use and some of
      them are applied inconsistently. Use the style recommended by cpplint:
      
          #ifndef SUBDIR_HEADER_H_
          #define SUBDIR_HEADER_H_
          ...
          #endif  // SUBDIR_HEADER_H_
      
      (with the C++-style comment replaced by a C-style comment in C files.)
      
      In installed headers, consistently add an extra guard that requires the
      header to be included via <gjs/gjs.h> instead of included directly.
      494dc062
    • Philip Chimento's avatar
      maint: Remove GLib custom types from some files · 39786302
      Philip Chimento authored
      In files where the IWYU tool would recommend including <glib.h> only for
      the custom types such as gint or gconstpointer, we instead remove usage
      of those types in favour of the plain old C types.
      39786302
    • Philip Chimento's avatar
      maint: Remove C-style NULLs from some files · 91667778
      Philip Chimento authored
      In files where the IWYU tool would recommend including <stddef.h> only
      for the symbol NULL, we instead remove usage of NULL in favour of
      C++-style nullptr, or implicit conversion to bool.
      91667778
    • Philip Chimento's avatar
      module: Remove explicit comparison with nullptr · 193f0509
      Philip Chimento authored
      The IWYU tool recommends including <memory> here, only for the reason of
      using std::unique_ptr::operator!=(nullptr_t) but we can just avoid
      including an extra header by using implicit conversion to bool.
      193f0509
    • Philip Chimento's avatar
      maint: Rename variables named "string" · fff57485
      Philip Chimento authored
      Having a variable named "string" causes a weird false positive case of
      CPPLINT. Regardless, it's better to describe what the string is for.
      fff57485
    • Philip Chimento's avatar
      macros: Move GJS_ALWAYS_INLINE to macros.h · 16720267
      Philip Chimento authored
      This way, the macro can be used without including all of jsapi-util.h.
      16720267
    • Philip Chimento's avatar
      interface: Move to C++-style API · da2c62c4
      Philip Chimento authored
      This allows cleaning up the public API in interface.h a bit, removing C
      API that only called C++ API.
      
      The idea is to gradually provide more typesafe, C++-style APIs for all
      of the GI wrapper classes, and change calling code to use them rather
      than the old C-style APIs.
      da2c62c4