2003-03-30 Matthias Clasen <maclas@gmx.de>
* glib/gstring.c (g_string_new): Optimize the common cases
(init == NULL or init == "") a bit.
* glib/gmarkup.c, glib/gmessages.c, glib/gscanner.c,
glib/gshell.c, glib/gspawn-win32-helper.c, glib/gspawn-win32.c,
glib/gspawn.c, gobject/gvaluetransform.c: replace uses of
g_string_new ("") by g_string_new (NULL). (#106973, Morten Welinder)
15 files changed:
2003-03-30 Matthias Clasen <maclas@gmx.de>
2003-03-30 Matthias Clasen <maclas@gmx.de>
+ * glib/gstring.c (g_string_new): Optimize the common cases
+ (init == NULL or init == "") a bit.
+ * glib/gmarkup.c, glib/gmessages.c, glib/gscanner.c,
+ glib/gshell.c, glib/gspawn-win32-helper.c, glib/gspawn-win32.c,
+ glib/gspawn.c, gobject/gvaluetransform.c: replace uses of
+ g_string_new ("") by g_string_new (NULL). (#106973, Morten Welinder)
+
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
2003-03-30 Matthias Clasen <maclas@gmx.de>
2003-03-30 Matthias Clasen <maclas@gmx.de>
+ * glib/gstring.c (g_string_new): Optimize the common cases
+ (init == NULL or init == "") a bit.
+ * glib/gmarkup.c, glib/gmessages.c, glib/gscanner.c,
+ glib/gshell.c, glib/gspawn-win32-helper.c, glib/gspawn-win32.c,
+ glib/gspawn.c, gobject/gvaluetransform.c: replace uses of
+ g_string_new ("") by g_string_new (NULL). (#106973, Morten Welinder)
+
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
2003-03-30 Matthias Clasen <maclas@gmx.de>
2003-03-30 Matthias Clasen <maclas@gmx.de>
+ * glib/gstring.c (g_string_new): Optimize the common cases
+ (init == NULL or init == "") a bit.
+ * glib/gmarkup.c, glib/gmessages.c, glib/gscanner.c,
+ glib/gshell.c, glib/gspawn-win32-helper.c, glib/gspawn-win32.c,
+ glib/gspawn.c, gobject/gvaluetransform.c: replace uses of
+ g_string_new ("") by g_string_new (NULL). (#106973, Morten Welinder)
+
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
2003-03-30 Matthias Clasen <maclas@gmx.de>
2003-03-30 Matthias Clasen <maclas@gmx.de>
+ * glib/gstring.c (g_string_new): Optimize the common cases
+ (init == NULL or init == "") a bit.
+ * glib/gmarkup.c, glib/gmessages.c, glib/gscanner.c,
+ glib/gshell.c, glib/gspawn-win32-helper.c, glib/gspawn-win32.c,
+ glib/gspawn.c, gobject/gvaluetransform.c: replace uses of
+ g_string_new ("") by g_string_new (NULL). (#106973, Morten Welinder)
+
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
2003-03-30 Matthias Clasen <maclas@gmx.de>
2003-03-30 Matthias Clasen <maclas@gmx.de>
+ * glib/gstring.c (g_string_new): Optimize the common cases
+ (init == NULL or init == "") a bit.
+ * glib/gmarkup.c, glib/gmessages.c, glib/gscanner.c,
+ glib/gshell.c, glib/gspawn-win32-helper.c, glib/gspawn-win32.c,
+ glib/gspawn.c, gobject/gvaluetransform.c: replace uses of
+ g_string_new ("") by g_string_new (NULL). (#106973, Morten Welinder)
+
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
2003-03-30 Matthias Clasen <maclas@gmx.de>
2003-03-30 Matthias Clasen <maclas@gmx.de>
+ * glib/gstring.c (g_string_new): Optimize the common cases
+ (init == NULL or init == "") a bit.
+ * glib/gmarkup.c, glib/gmessages.c, glib/gscanner.c,
+ glib/gshell.c, glib/gspawn-win32-helper.c, glib/gspawn-win32.c,
+ glib/gspawn.c, gobject/gvaluetransform.c: replace uses of
+ g_string_new ("") by g_string_new (NULL). (#106973, Morten Welinder)
+
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
* glib/gutf8.c (UNICODE_VALID): Update to Unicode 3.1 and optimize
a bit. (#107427, Noah Lewitt)
UnescapeState state;
const gchar *start;
UnescapeState state;
const gchar *start;
- str = g_string_new ("");
+ str = g_string_new (NULL);
state = USTATE_INSIDE_TEXT;
p = text;
state = USTATE_INSIDE_TEXT;
p = text;
const gchar *text_end)
{
if (context->partial_chunk == NULL)
const gchar *text_end)
{
if (context->partial_chunk == NULL)
- context->partial_chunk = g_string_new ("");
+ context->partial_chunk = g_string_new (NULL);
if (text_start != text_end)
g_string_append_len (context->partial_chunk, text_start,
if (text_start != text_end)
g_string_append_len (context->partial_chunk, text_start,
if (length < 0)
length = strlen (text);
if (length < 0)
length = strlen (text);
- str = g_string_new ("");
+ str = g_string_new (NULL);
append_escaped_text (str, text, length);
return g_string_free (str, FALSE);
append_escaped_text (str, text, length);
return g_string_free (str, FALSE);
fd = mklevel_prefix (level_prefix, log_level);
fd = mklevel_prefix (level_prefix, log_level);
- gstring = g_string_new ("");
+ gstring = g_string_new (NULL);
if (log_level & ALERT_LEVELS)
g_string_append (gstring, "\n");
if (!log_domain)
if (log_level & ALERT_LEVELS)
g_string_append (gstring, "\n");
if (!log_domain)
g_scanner_get_char (scanner, line_p, position_p);
token = G_TOKEN_COMMENT_MULTI;
in_comment_multi = TRUE;
g_scanner_get_char (scanner, line_p, position_p);
token = G_TOKEN_COMMENT_MULTI;
in_comment_multi = TRUE;
- gstring = g_string_new ("");
+ gstring = g_string_new (NULL);
while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
{
if (ch == '*' && g_scanner_peek_next_char (scanner) == '/')
while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
{
if (ch == '*' && g_scanner_peek_next_char (scanner) == '/')
goto default_case;
token = G_TOKEN_STRING;
in_string_sq = TRUE;
goto default_case;
token = G_TOKEN_STRING;
in_string_sq = TRUE;
- gstring = g_string_new ("");
+ gstring = g_string_new (NULL);
while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
{
if (ch == '\'')
while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
{
if (ch == '\'')
goto default_case;
token = G_TOKEN_STRING;
in_string_dq = TRUE;
goto default_case;
token = G_TOKEN_STRING;
in_string_dq = TRUE;
- gstring = g_string_new ("");
+ gstring = g_string_new (NULL);
while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
{
if (ch == '"')
while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
{
if (ch == '"')
{
token = G_TOKEN_COMMENT_SINGLE;
in_comment_single = TRUE;
{
token = G_TOKEN_COMMENT_SINGLE;
in_comment_single = TRUE;
- gstring = g_string_new ("");
+ gstring = g_string_new (NULL);
ch = g_scanner_get_char (scanner, line_p, position_p);
while (ch != 0)
{
ch = g_scanner_get_char (scanner, line_p, position_p);
while (ch != 0)
{
g_scanner_peek_next_char (scanner)))
{
token = G_TOKEN_IDENTIFIER;
g_scanner_peek_next_char (scanner)))
{
token = G_TOKEN_IDENTIFIER;
- gstring = g_string_new ("");
+ gstring = g_string_new (NULL);
gstring = g_string_append_c (gstring, ch);
do
{
gstring = g_string_append_c (gstring, ch);
do
{
start = unquoted;
end = unquoted;
start = unquoted;
end = unquoted;
- retval = g_string_new ("");
+ retval = g_string_new (NULL);
/* The loop allows cases such as
* "foo"blah blah'bar'woo foo"baz"la la la\'\''foo'
/* The loop allows cases such as
* "foo"blah blah'bar'woo foo"baz"la la la\'\''foo'
ensure_token (GString **token)
{
if (*token == NULL)
ensure_token (GString **token)
{
if (*token == NULL)
- *token = g_string_new ("");
+ *token = g_string_new (NULL);
- debugstring = g_string_new ("");
+ debugstring = g_string_new (NULL);
g_string_append (debugstring,
g_strdup_printf ("writing error code %d and errno %d",
msg, en));
g_string_append (debugstring,
g_strdup_printf ("writing error code %d and errno %d",
msg, en));
- debugstring = g_string_new ("");
+ debugstring = g_string_new (NULL);
g_string_append (debugstring,
g_strdup_printf ("g-spawn-win32-helper: "
g_string_append (debugstring,
g_strdup_printf ("g-spawn-win32-helper: "
- debugstring = g_string_new ("");
+ debugstring = g_string_new (NULL);
g_string_append (debugstring,
g_strdup_printf ("calling %s %s mode=%s argv: ",
(__argv[ARG_USE_PATH][0] == 'y' ?
g_string_append (debugstring,
g_strdup_printf ("calling %s %s mode=%s argv: ",
(__argv[ARG_USE_PATH][0] == 'y' ?
- debugstring = g_string_new ("");
+ debugstring = g_string_new (NULL);
g_string_append (debugstring,
g_strdup_printf ("%s returned %#x",
(__argv[ARG_USE_PATH][0] == 'y' ?
g_string_append (debugstring,
g_strdup_printf ("%s returned %#x",
(__argv[ARG_USE_PATH][0] == 'y' ?
- outstr = g_string_new ("");
+ outstr = g_string_new (NULL);
outchannel = g_io_channel_win32_new_fd (outpipe);
g_io_channel_set_encoding (outchannel, NULL, NULL);
g_io_channel_win32_make_pollfd (outchannel,
outchannel = g_io_channel_win32_new_fd (outpipe);
g_io_channel_set_encoding (outchannel, NULL, NULL);
g_io_channel_win32_make_pollfd (outchannel,
- errstr = g_string_new ("");
+ errstr = g_string_new (NULL);
errchannel = g_io_channel_win32_new_fd (errpipe);
g_io_channel_set_encoding (errchannel, NULL, NULL);
g_io_channel_win32_make_pollfd (errchannel,
errchannel = g_io_channel_win32_new_fd (errpipe);
g_io_channel_set_encoding (errchannel, NULL, NULL);
g_io_channel_win32_make_pollfd (errchannel,
- outstr = g_string_new ("");
+ outstr = g_string_new (NULL);
- errstr = g_string_new ("");
+ errstr = g_string_new (NULL);
}
/* Read data until we get EOF on both pipes. */
}
/* Read data until we get EOF on both pipes. */
- string = g_string_sized_new (init ? strlen (init) + 2 : 2);
+ if (init == NULL || *init == '\0')
+ string = g_string_sized_new (2);
+ else
+ {
+ gint len;
+
+ len = strlen (init);
+ string = g_string_sized_new (len + 2);
- if (init)
- g_string_append (string, init);
+ g_string_append_len (string, init, len);
+ }
- GString *gstring = g_string_new ("");
+ GString *gstring = g_string_new (NULL);
guint v_flags = src_value->data[0].v_uint;
do
guint v_flags = src_value->data[0].v_uint;
do