add a g_byte_array_sized_new() helper if we compile for glib < 2

svn path=/trunk/; revision=23373
This commit is contained in:
Ronnie Sahlberg 2007-11-06 05:51:49 +00:00
parent 8da1f94cca
commit 7885237398
2 changed files with 19 additions and 0 deletions

View File

@ -1018,6 +1018,20 @@ g_strlcpy(gchar *dest, const gchar *src, gsize dest_size)
}
#endif
/* g_byte_array_sized_new() doesnt exist in glib-1.2 */
#if GLIB_MAJOR_VERSION < 2
GByteArray *
g_byte_array_sized_new(guint reserved_size)
{
GByteArray *gba;
gba = g_byte_array_new();
g_byte_array_set_size(gba, reserved_size);
return gba;
}
#endif
char *
epan_strcasestr(const char *haystack, const char *needle)
{

View File

@ -235,4 +235,9 @@ gsize g_strlcpy(gchar *dest, const gchar *src, gsize dest_size);
#endif
#if GLIB_MAJOR_VERSION < 2
/* g_byte_array_sized_new() doesnt exist in glib-1.2 */
GByteArray *g_byte_array_sized_new(guint reserved_size);
#endif
#endif /* __STRUTIL_H__ */