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 112365 - add g_strdup_vprintf_len
add g_strdup_vprintf_len
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.2.x
Other Windows
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 92492 101997
 
 
Reported: 2003-05-06 07:36 UTC by Matthias Clasen
Modified: 2011-02-18 16:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.34 KB, patch)
2003-05-06 21:53 UTC, Matthias Clasen
none Details | Review

Description Matthias Clasen 2003-05-06 07:36:43 UTC
it would be useful to avoid some strlens which in turn would allow to 
handle embedded nuls in some places (see the bugs depending on this)
Comment 1 Matthias Clasen 2003-05-06 21:53:57 UTC
Created attachment 16314 [details] [review]
patch
Comment 2 Owen Taylor 2003-05-23 21:17:42 UTC
Looks basically fine ... I'm not sure about the name
and signature. Having an out int as the first parameter
is distinctly unusual and _len normally signifies
a char*/len pair is being passed in.

I can't think of a better name, but for the signature
perhaps

 gboolean g_strdup_vprintf_len (gchar **buffer, gint *len,
                                gchar *format, ...);

(g_memdup_vprintf() would be an accurate name, but not
a particularly obvious one.)
Comment 3 Matthias Clasen 2003-05-23 23:16:14 UTC
How about

gchar *g_strdup_vprintf_size (const gchar *format, 
                              gint        *size, 
                              va_list      args)

I think as long as the name starts with g_strdup, we should keep the 
gchar * return. Otherwise, we could simply go for 

gint g_vasprintf (gchar       **buffer,
                  const gchar  *format, 
                  va_list       args) 
Comment 4 Owen Taylor 2003-06-02 20:15:54 UTC
Of the ideas, I like the idea of a g_vasprintf() with exactly 
the same arguments as the GNU functions best.
Comment 5 Matthias Clasen 2003-06-05 22:48:22 UTC
I've added g_vasprintf() now.