GNOME Bugzilla – Bug 634253
Support any null-terminated C array (to JS)
Last modified: 2011-05-13 15:49:21 UTC
gjs_value_from_g_argument says: "FIXME: Only supporting null-terminated arrays of strings" and we don't like FIXMEs, do we?
Created attachment 174030 [details] [review] Support null terminated C arrays of any type Before, only string arrays (GStrv) were supported. Now C arrays can be converted to JS arrays regardless of their type.
Review of attachment 174030 [details] [review]: This looks quite good in general, but you need to add some tests for this and run make valgrind-check to make sure you don't leak anything.
Created attachment 181176 [details] [review] Support null terminated C arrays of any type Before, only string arrays (GStrv) were supported. Now C arrays can be converted to JS arrays regardless of their type.
It looks like this issue prevents xrandr-indicator to work https://bugzilla.gnome.org/show_bug.cgi?id=649077 Why has this patch not applied yet to the git version?
Review of attachment 181176 [details] [review]: ::: gi/arg.c @@ +1986,2 @@ } Is there a reason we can't remove the special case for GI_TYPE_TAG_UTF8 above and just rely on gjs_array_from_zero_terminated_c_array() to handle char**?
Created attachment 187740 [details] [review] Add tests for returning zero-terminated arrays of non-strings gjs has always supported zero-terminated arrays of strings, and nothing else. Now that this changed, we need to test it. (Patch against gobject-introspection for libgimarshallingtests)
Created attachment 187741 [details] [review] Support null terminated C arrays of any type Before, only string arrays (GStrv) were supported. Now C arrays can be converted to JS arrays regardless of their type. Now with tests!
Review of attachment 187741 [details] [review]: One minor issue (only relevant on older SpiderMonkey), feel free to commit after fixing. ::: gi/arg.c @@ +1914,3 @@ + +finally: + JS_RemoveValueRoot(context, &elem); There's no call to JS_AddValueRoot corresponding to this.
Comment on attachment 187740 [details] [review] Add tests for returning zero-terminated arrays of non-strings Attachment 187740 [details] pushed as b29b3ec - Add tests for returning zero-terminated arrays of non-strings
Attachment 187741 [details] pushed as 23c687d - Support null terminated C arrays of any type