Hello,
I examined the code generated by vala and found a problem.
Vala does an unnecessary g_strdup() call if I return StringBuilder.str as
return value.
For example:

function string get_str() {
  var str = new StringBuilder();
  str.append("some stuff");
  return str.str
}

Ideally this should generate
return g_string_free(str, FALSE);

but currently vala returns something like
result = g_strdup(str.str);
g_string_free(str, TRUE);
return result;

Apparently, this causes a unnecessary strdup() call.
Is it possible to return g_string_free(str, FALSE) instead?
Maybe I missed some ownership transfer thing?

Thanks
_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to