mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 02:30:35 +00:00
samiparse: clean up some GString usage
There's no need to re-assign the return value of g_string_append_*() functions and such to the variable holding the GString. These return values are just for convenience so function calls can be chained. The actual GString pointer won't change, it's not a GList after all. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2685>
This commit is contained in:
parent
270d23c8e0
commit
f19f579712
1 changed files with 13 additions and 13 deletions
|
@ -369,7 +369,7 @@ unescape_string (const gchar * text)
|
|||
|
||||
/* unescape   and */
|
||||
if (!g_ascii_strncasecmp (text, "nbsp", 4)) {
|
||||
unescaped = g_string_append_unichar (unescaped, 160);
|
||||
g_string_append_unichar (unescaped, 160);
|
||||
text += 4;
|
||||
if (*text == ';') {
|
||||
text++;
|
||||
|
@ -384,10 +384,9 @@ unescape_string (const gchar * text)
|
|||
|
||||
if (!g_ascii_strncasecmp (text, entity->escaped, escaped_len)
|
||||
&& text[escaped_len] == ';') {
|
||||
unescaped = g_string_append_c (unescaped, '&');
|
||||
unescaped =
|
||||
g_string_append_len (unescaped, entity->escaped, escaped_len);
|
||||
unescaped = g_string_append_c (unescaped, ';');
|
||||
g_string_append_c (unescaped, '&');
|
||||
g_string_append_len (unescaped, entity->escaped, escaped_len);
|
||||
g_string_append_c (unescaped, ';');
|
||||
text += escaped_len + 1;
|
||||
goto next;
|
||||
}
|
||||
|
@ -400,7 +399,7 @@ unescape_string (const gchar * text)
|
|||
|
||||
if (!strncmp (text, entity->escaped, escaped_len)
|
||||
&& text[escaped_len] == ';') {
|
||||
unescaped = g_string_append_unichar (unescaped, entity->unescaped);
|
||||
g_string_append_unichar (unescaped, entity->unescaped);
|
||||
text += escaped_len + 1;
|
||||
goto next;
|
||||
}
|
||||
|
@ -427,7 +426,7 @@ unescape_string (const gchar * text)
|
|||
/* error occurred. pass it */
|
||||
goto next;
|
||||
}
|
||||
unescaped = g_string_append_unichar (unescaped, l);
|
||||
g_string_append_unichar (unescaped, l);
|
||||
text = end;
|
||||
|
||||
if (*text == ';') {
|
||||
|
@ -437,19 +436,19 @@ unescape_string (const gchar * text)
|
|||
}
|
||||
|
||||
/* escape & */
|
||||
unescaped = g_string_append (unescaped, "&");
|
||||
g_string_append (unescaped, "&");
|
||||
|
||||
next:
|
||||
continue;
|
||||
|
||||
} else if (g_ascii_isspace (*text)) {
|
||||
unescaped = g_string_append_c (unescaped, ' ');
|
||||
g_string_append_c (unescaped, ' ');
|
||||
/* strip whitespace */
|
||||
do {
|
||||
text++;
|
||||
} while ((*text) && g_ascii_isspace (*text));
|
||||
} else {
|
||||
unescaped = g_string_append_c (unescaped, *text);
|
||||
g_string_append_c (unescaped, *text);
|
||||
text++;
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +536,8 @@ static void
|
|||
html_context_parse (HtmlContext * ctxt, gchar * text, gsize text_len)
|
||||
{
|
||||
const gchar *next = NULL;
|
||||
ctxt->buf = g_string_append_len (ctxt->buf, text, text_len);
|
||||
|
||||
g_string_append_len (ctxt->buf, text, text_len);
|
||||
next = ctxt->buf->str;
|
||||
while (TRUE) {
|
||||
if (next[0] == '<') {
|
||||
|
@ -896,9 +896,9 @@ parse_sami (ParserState * state, const gchar * line)
|
|||
|
||||
if (context->has_result) {
|
||||
if (context->rubybuf->len) {
|
||||
context->rubybuf = g_string_append_c (context->rubybuf, '\n');
|
||||
g_string_append_c (context->rubybuf, '\n');
|
||||
g_string_prepend (context->resultbuf, context->rubybuf->str);
|
||||
context->rubybuf = g_string_truncate (context->rubybuf, 0);
|
||||
g_string_truncate (context->rubybuf, 0);
|
||||
}
|
||||
|
||||
ret = g_string_free (context->resultbuf, FALSE);
|
||||
|
|
Loading…
Reference in a new issue