After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 593859 - Accessing the length of a function that returns an array does not emit the function call in C
Accessing the length of a function that returns an array does not emit the fu...
Status: RESOLVED DUPLICATE of bug 585847
Product: vala
Classification: Core
Component: Arrays
0.7.x
Other All
: Normal critical
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-01 23:03 UTC by Mark Lee
Modified: 2009-09-15 17:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mark Lee 2009-09-01 23:03:58 UTC
I observed this behavior with KeyFile.get_groups().

Vala testcase:

extern string[] get_strings ();

void print_string_count () {
    message ("string count: %d", get_strings ().length);
}

Generated code (in both 0.7.4 and 0.7.6~git, as of 2009/09/01):

char** get_strings (int* result_length1);
void print_string_count (void);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);



void print_string_count (void) {
        gint _tmp1__length1;
        char** _tmp1_;
        gint _tmp0_;
        _tmp1_ = NULL;
        g_message ("array-return-test.vala:4: string count: %d", _tmp0_);
        _tmp1_ = (_vala_array_free (_tmp1_, _tmp1__length1, (GDestroyNotify) g_free), NULL);
}

// definitions for _vala_array_destroy and _vala_array_free

If you replace the message() statement above with the following code, it emits the correct C:

    string[] res;

    res = get_strings ();
    message ("string count: %d", res.length);
Comment 1 Jürg Billeter 2009-09-15 17:13:02 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 585847 ***