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 340134 - pango_layout_set_text_static
pango_layout_set_text_static
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: Small API
Assigned To: Behdad Esfahbod
pango-maint
Depends on:
Blocks:
 
 
Reported: 2006-04-29 19:09 UTC by Behdad Esfahbod
Modified: 2017-08-31 23:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
my patch (2.26 KB, patch)
2006-06-06 09:05 UTC, LingNing Zhang
none Details | Review
modified patch (5.34 KB, patch)
2006-06-07 08:03 UTC, LingNing Zhang
none Details | Review

Description Behdad Esfahbod 2006-04-29 19:09:05 UTC
Implement it.  It should not copy text, unless absolutely necessary (text not valid, not nul-terminated.)


We may change Pango to not require nul-termination, so we don't have to copy text in _static if length >= 0.  The only remaining problem would be that then pango_layout_get_text will not necessarily return a nul-terminated string.  But that's Ok if the input text wasn't nul-terminated.  We may then want to add a pango_layout_get_text_len().
Comment 1 LingNing Zhang 2006-06-05 08:39:23 UTC
I think it is troubling that users must know the text is static or dynamic when they call pango_layout_set_text( ) or pango_layout_set_text_static( ).
Comment 2 Behdad Esfahbod 2006-06-06 05:45:37 UTC
No LingNing.  This is not confusing.  Users can still use pango_layout_set_text() as they were doing.  The _static() version on the other hand is used if the text passed in will be available and not change during the life cycle of the layout, and so doesn't need to be duplicated.
Comment 3 LingNing Zhang 2006-06-06 09:05:39 UTC
Created attachment 66812 [details] [review]
my patch

I wrote a patch for this bug. But I think this patch need to modify.
I think that "free(old_text)" will be modified and the struct of PangoLayout will be added a member about "guint static_text".
Comment 4 LingNing Zhang 2006-06-07 08:03:33 UTC
Created attachment 66888 [details] [review]
modified patch

I modified my patch for adding a member of PangoLayout and the codes about this member.
And my thought in this patch is that we need copy text in pango_layout_set_text_static( ) if length > 0.
I think that it has some problems if we don't copy text in pango_layout_set_text_static( ) when length > 0. And will it have some trouble if users call pango_layout_get_text( ).