| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As found in https://gitlab.gnome.org/GNOME/gjs/-/issues/361, getting the
GType using g_registered_type_info_get_g_type() is very expensive and
can make up for a significant part of the overhead when calling into a C
function.
Since the argument cache seems to be fairly small in a typical
gnome-shell session (about 1300 entries), the total increased memory
usage of about 10kB seems very reasonable given the benefits of the
caching.
This reverts commit adfb7dc3ba79b17b0cefa47f5249e9da917217ad.
|
|\
| |
| |
| |
| |
| |
| | |
Fixed error in _init() that prevented GType objects from being created
Closes #238
See merge request GNOME/gjs!508
|
|/
|
|
|
|
| |
Improved the regression test, implementing Marco T's feedback.
Closes #238.
|
|\
| |
| |
| |
| |
| |
| | |
Support passing GValue as an actual pointer
Closes #74
See merge request GNOME/gjs!507
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When we create a GValue using the actual constructor we're holding
internally a boxed type, and in such case we don't have to try to
convert it to another GValue to pass around, but we should just use it
as our argument.
However, this can't be computed when parsing the argument, but depends
case-by-case, as per this when we've a GValue and this is an object
containing an actual GValue, pass it around and remember that we've not
to free the returned argument, as that will be handled by the boxed
wrapper.
This allows to finally use some Gtk functions to get GValue parameters
as "in/out" parameters, and the gvalue copy function.
Add tests checking that this is the case.
Fixes #74
|
| |
| |
| |
| |
| |
| |
| |
| | |
In case we've an allocated-directly GValue, freeing its pointer is not
enough, as it may contain a string or a more complex type that actual
need further actions.
So, in such case also unset the GValue.
|
|/
|
|
|
|
|
| |
If our argument is a GValue and it's marked as the instance parameter,
then it means we're calling a g_value_* function, and as per this we
should not pass a temporary value but we can just pass the object we've
initialized locally.
|
| |
|
|
|
|
| |
(Philip: changed to use size_t index to iterate through array)
|
| |
|
|
|
|
| |
We can easily use different codepaths, choosing statically
|
| |
|
|
|
|
|
|
| |
Now that we rely on static compiler checks for type safety and
conversions, we can use just one function to handle the conversion of
all the numerc types as the compiler will do the job for us.
|
|
|
|
|
| |
No need to do this in other cases, so let's just throw early and retu
false if this happens.
|
|
|
|
|
|
| |
When using a template-typed function we already have the static type
string available, so we don't need to call another function and use an
extra parameter.
|
|
|
|
|
|
|
|
| |
So far when associating JS arrays to C ones we were always creating a
temporary variable to store the value, before casting it to the final
type, but in case we're handling arrays of types for which we've a
direct conversion function, we don't need to do this, so in such case
let's just call the conversion function on the array element.
|
|
|
|
|
|
|
|
|
|
| |
Even in this case we can just implement this using a specialized
implementaiton of js_value_to_c.
However, since the array contains new strings we also need to templatize
the array allocation and free functions, so that we memzero it and we deeply
free it in case we handle a GStrv.
As per this, only set the last element to NULL on non-string arrays
|
|
|
|
|
|
| |
GValue arrays are parsed as the other kinds of arrays, once we set up a
proper js_value_to_c() for it, we can just rely on the default
implementation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When creating arrays for simple types we can just reuse a single
function with typed parameters and reuse functions to fetch the value
from JS, storing it in the proper container.
Added a specialization for boolean types and GType. However, since we need
to make sure it's not confused with the same typedef'ed original type, we
need to use the type tag as well.
As per this, convert the js-value-inl utility functions to template
functions with implicit values, and specialize the ones we need to.
In particular we need a js_value_to_c() specialization for the GType tag
that gets an object and fetches the gtype from it.
We can just return in case of errors, as the generic function will take
care of throwing, in case.
All this permits a nice code cleanup and more type-safety.
(Philip: Added char32_t specializations)
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
Fix fundamental parameters.
Closes #353
See merge request GNOME/gjs!506
|
|/
|
|
|
|
| |
Addresses regression where fundamental objects cannot be passed into functions.
Fixes #353
|
|\
| |
| |
| |
| | |
Prevent passing null pointers when not nullable.
See merge request GNOME/gjs!503
|
| |
| |
| |
| | |
Use GLib.str_hash until Regress has a suitable test case.
|
| |
| |
| |
| | |
The arg-cache marshaller for null (pointers) doesn't check if the argument is nullable. This is a regression introduced by the arg-cache that can cause segfaults in functions such as GLib.str_hash.
|
|\ \
| | |
| | |
| | |
| | | |
September maintenance
See merge request GNOME/gjs!502
|
| | |
| | |
| | |
| | |
| | | |
For details see
https://github.com/include-what-you-use/include-what-you-use/issues/226
|
| | |
| | |
| | |
| | | |
This is for compiling warning-free on Clang.
|
| | |
| | |
| | |
| | |
| | |
| | | |
GCC accepts this, but when compiling with Clang we get an error that the
random number generator cannot be instantiated in a constant expression.
That makes sense.
|
| | |
| | |
| | |
| | |
| | | |
Rationale: this code was likely written on a 32-bit system in 2011 in
which G_MAXULONG would have been 4294967295, not 18446744073709551615.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The vm_size that was read out of /proc/self/stat was not actually used
anywhere, so don't read it. According to 'man proc', the correct sscanf
specifier to read rss_size is %ld, meaning that it's a signed long int, so
change that while we're here.
|
| | |
| | |
| | |
| | | |
This is in order to support compilation with G_DISABLE_ASSERT.
|
| | |
| | |
| | |
| | |
| | | |
Previously, these jobs were only using clang for compiling the few C files
in the project.
|
| | |
| | |
| | |
| | |
| | |
| | | |
This adds a SPDX-License-Identifier comment to all files that are part
of GJS, part of its unit tests, or auxiliary tools. (Except for some
files like the debugger scripts that don't support comments.)
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The provenance of this image wasn't known, so replace it with a new image
that is known to be in the public domain.
Downloaded from https://www.flickr.com/photos/135396164@N05/30127978380
Dedicated to the public domain, CC0-1.0.
|
| | |
| | |
| | |
| | |
| | | |
This example was originally copied from Seed's examples, so it gets the
copyright and license information from Seed.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I copied the lcovrc and GLib's dependencies' wrap files from the GLib
repository, so they need to get GLib's license. Except for zlib.wrap,
which was copied from the Meson wrapdb, so it gets the license from
https://github.com/mesonbuild/zlib/blob/master/LICENSE.build
|
| | |
| | |
| | |
| | | |
Ref: https://github.com/barisione/clang-format-hooks/blob/master/COPYING
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The SPDX format is machine-readable, which should make it much easier to
avoid mistakes with licensing and copyright using automated tools.
This commit does not add any implicit information. It converts exactly
what was already specified into SPDX format comments.
|
| | |
| | |
| | |
| | |
| | | |
The stack printer code that was copied from Mozilla was removed quite
some time ago, we use js::DumpBacktrace now.
|
| | |
| | |
| | |
| | | |
I noticed it was broken while testing it with a new test.jpg image.
|
| | |
| | |
| | |
| | | |
Probably a copy-paste error.
|
|/ /
| |
| |
| |
| | |
This script was used in a now-deleted Makefile rule. It's not used any
more.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We already have a function to set a GArgument from the JS value, taking care
of number conversions and out of bound errors, that is used in arg in the
same way, so let's use this function to be consistent, ensuring that we can
save each type in a container type big enough and that, in case we go out of
bounds we can handle this correctly.
Only use a simple function override, so that we can handle the out of
bound errors the same way we used to do.
|
| |
| |
| |
| |
| |
| | |
This allows compile-time computation of the type name as a string.
(Philip: split out from another commit)
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use a template-function to convert all the JS Values to the proper c++
type and ensure they're within the valid ranges.
As per this we need to use a more relaxed conversion to unsigned types using
doubles not to have implicit conversion of negative types.
Use a function override in order to keep a more generic version as
inline implementation, while we specialize the out-of-range error
handling per type
|
|/
|
|
|
|
|
|
|
|
|
|
| |
Add template functions to get the JS value to a variable that is big
enough to fit the requested type, doing also checks in case the
resulting value is out of bounding for the requested type.
This allows to redefine hashtable_int_key() so that there's no type
checks and will allow to get values per type.
Move the functions to a different header not to bother arg with such
stuff that might be re-used also by other code paths
|
|\
| |
| |
| |
| | |
Trampoline cleanups
See merge request GNOME/gjs!491
|