mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-12 10:45:13 +01:00
Optimize the common cases (init == NULL or init == "") a bit. replace uses
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)
This commit is contained in:
parent
cb0e4de11c
commit
6710fd6e06
@ -1,5 +1,12 @@
|
||||
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)
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
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)
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
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)
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
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)
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
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)
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
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)
|
||||
|
||||
|
@ -335,7 +335,7 @@ unescape_text (GMarkupParseContext *context,
|
||||
UnescapeState state;
|
||||
const gchar *start;
|
||||
|
||||
str = g_string_new ("");
|
||||
str = g_string_new (NULL);
|
||||
|
||||
state = USTATE_INSIDE_TEXT;
|
||||
p = text;
|
||||
@ -681,7 +681,7 @@ add_to_partial (GMarkupParseContext *context,
|
||||
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,
|
||||
@ -1821,7 +1821,7 @@ g_markup_escape_text (const gchar *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);
|
||||
|
@ -767,7 +767,7 @@ g_log_default_handler (const gchar *log_domain,
|
||||
|
||||
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)
|
||||
|
@ -1267,7 +1267,7 @@ g_scanner_get_token_ll (GScanner *scanner,
|
||||
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) == '/')
|
||||
@ -1287,7 +1287,7 @@ g_scanner_get_token_ll (GScanner *scanner,
|
||||
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 == '\'')
|
||||
@ -1306,7 +1306,7 @@ g_scanner_get_token_ll (GScanner *scanner,
|
||||
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 == '"')
|
||||
@ -1612,7 +1612,7 @@ g_scanner_get_token_ll (GScanner *scanner,
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -1637,7 +1637,7 @@ g_scanner_get_token_ll (GScanner *scanner,
|
||||
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
|
||||
{
|
||||
|
@ -258,7 +258,7 @@ g_shell_unquote (const gchar *quoted_string,
|
||||
|
||||
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'
|
||||
@ -390,7 +390,7 @@ static inline void
|
||||
ensure_token (GString **token)
|
||||
{
|
||||
if (*token == NULL)
|
||||
*token = g_string_new ("");
|
||||
*token = g_string_new (NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -37,7 +37,7 @@ write_err_and_exit (gint fd,
|
||||
|
||||
if (debug)
|
||||
{
|
||||
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));
|
||||
@ -82,7 +82,7 @@ WinMain (struct HINSTANCE__ *hInstance,
|
||||
|
||||
if (debug)
|
||||
{
|
||||
debugstring = g_string_new ("");
|
||||
debugstring = g_string_new (NULL);
|
||||
|
||||
g_string_append (debugstring,
|
||||
g_strdup_printf ("g-spawn-win32-helper: "
|
||||
@ -212,7 +212,7 @@ WinMain (struct HINSTANCE__ *hInstance,
|
||||
|
||||
if (debug)
|
||||
{
|
||||
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' ?
|
||||
@ -237,7 +237,7 @@ WinMain (struct HINSTANCE__ *hInstance,
|
||||
|
||||
if (debug)
|
||||
{
|
||||
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' ?
|
||||
|
@ -361,7 +361,7 @@ g_spawn_sync (const gchar *working_directory,
|
||||
|
||||
if (outpipe >= 0)
|
||||
{
|
||||
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,
|
||||
@ -371,7 +371,7 @@ g_spawn_sync (const gchar *working_directory,
|
||||
|
||||
if (errpipe >= 0)
|
||||
{
|
||||
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,
|
||||
|
@ -263,12 +263,12 @@ g_spawn_sync (const gchar *working_directory,
|
||||
|
||||
if (outpipe >= 0)
|
||||
{
|
||||
outstr = g_string_new ("");
|
||||
outstr = g_string_new (NULL);
|
||||
}
|
||||
|
||||
if (errpipe >= 0)
|
||||
{
|
||||
errstr = g_string_new ("");
|
||||
errstr = g_string_new (NULL);
|
||||
}
|
||||
|
||||
/* Read data until we get EOF on both pipes. */
|
||||
|
@ -235,10 +235,17 @@ g_string_new (const gchar *init)
|
||||
{
|
||||
GString *string;
|
||||
|
||||
string = g_string_sized_new (init ? strlen (init) + 2 : 2);
|
||||
if (init == NULL || *init == '\0')
|
||||
string = g_string_sized_new (2);
|
||||
else
|
||||
{
|
||||
gint len;
|
||||
|
||||
if (init)
|
||||
g_string_append (string, init);
|
||||
len = strlen (init);
|
||||
string = g_string_sized_new (len + 2);
|
||||
|
||||
g_string_append_len (string, init, len);
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ value_transform_flags_string (const GValue *src_value,
|
||||
|
||||
if (flags_value)
|
||||
{
|
||||
GString *gstring = g_string_new ("");
|
||||
GString *gstring = g_string_new (NULL);
|
||||
guint v_flags = src_value->data[0].v_uint;
|
||||
|
||||
do
|
||||
|
Loading…
x
Reference in New Issue
Block a user