projects
/
platform
/
upstream
/
glib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a8ea3dc
)
g_str_to_ascii(): a couple of minor tweaks
author
Ryan Lortie
<desrt@desrt.ca>
Thu, 20 Feb 2014 23:32:04 +0000
(18:32 -0500)
committer
Ryan Lortie
<desrt@desrt.ca>
Thu, 20 Feb 2014 23:32:42 +0000
(18:32 -0500)
Add a precondition guard and use g_string_sized_new() to avoid some
reallocations.
glib/gtranslit.c
patch
|
blob
|
history
diff --git
a/glib/gtranslit.c
b/glib/gtranslit.c
index
3cdfe94
..
5831456
100644
(file)
--- a/
glib/gtranslit.c
+++ b/
glib/gtranslit.c
@@
-331,6
+331,8
@@
g_str_to_ascii (const gchar *str,
GString *result;
guint item_id;
+ g_return_val_if_fail (str != NULL, NULL);
+
if (g_str_is_ascii (str))
return g_strdup (str);
@@
-339,7
+341,7
@@
g_str_to_ascii (const gchar *str,
else
item_id = get_default_item_id ();
- result = g_string_
new (NULL
);
+ result = g_string_
sized_new (strlen (str)
);
while (*str)
{