/* Reading file lists.
- Copyright (C) 1995-1998, 2000-2002, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998, 2000-2002, 2007, 2019 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
line_buf[--len] = '\0';
/* Test if we have to ignore the line. */
- if (*line_buf == '\0' || *line_buf == '#')
- continue;
-
- string_list_append_unique (result, line_buf);
+ if (!(*line_buf == '\0' || *line_buf == '#'))
+ /* Include the line in the result. */
+ string_list_append_unique (result, line_buf);
}
/* Free buffer allocated through getline. */
/* Internationalization Tag Set (ITS) handling
- Copyright (C) 2015, 2018 Free Software Foundation, Inc.
+ Copyright (C) 2015, 2018-2019 Free Software Foundation, Inc.
This file was written by Daiki Ueno <ueno@gnu.org>, 2015.
struct its_rule_ty *rule;
rule = its_rule_parse (doc, node);
- if (!rule)
- continue;
-
- if (rules->nitems == rules->nitems_max)
+ if (rule != NULL)
{
- rules->nitems_max = 2 * rules->nitems_max + 1;
- rules->items =
- xrealloc (rules->items,
- sizeof (struct its_rule_ty *) * rules->nitems_max);
+ if (rules->nitems == rules->nitems_max)
+ {
+ rules->nitems_max = 2 * rules->nitems_max + 1;
+ rules->items =
+ xrealloc (rules->items,
+ sizeof (struct its_rule_ty *) * rules->nitems_max);
+ }
+ rules->items[rules->nitems++] = rule;
}
- rules->items[rules->nitems++] = rule;
}
return true;
/* XML resource locating rules
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015, 2019 Free Software Foundation, Inc.
This file was written by Daiki Ueno <ueno@gnu.org>, 2015.
{
missing_attribute (node, "pattern");
xmlFreeDoc (doc);
- continue;
}
-
- memset (&rule, 0, sizeof (struct locating_rule_ty));
- rule.pattern = get_attribute (node, "pattern");
- if (xmlHasProp (node, BAD_CAST "name"))
- rule.name = get_attribute (node, "name");
- if (xmlHasProp (node, BAD_CAST "target"))
- rule.target = get_attribute (node, "target");
else
{
- xmlNode *n;
+ memset (&rule, 0, sizeof (struct locating_rule_ty));
+ rule.pattern = get_attribute (node, "pattern");
+ if (xmlHasProp (node, BAD_CAST "name"))
+ rule.name = get_attribute (node, "name");
+ if (xmlHasProp (node, BAD_CAST "target"))
+ rule.target = get_attribute (node, "target");
+ else
+ {
+ xmlNode *n;
- for (n = node->children; n; n = n->next)
+ for (n = node->children; n; n = n->next)
+ {
+ if (xmlStrEqual (n->name, BAD_CAST "documentRule"))
+ document_locating_rule_list_add (&rule.doc_rules, n);
+ }
+ }
+ if (rules->nitems == rules->nitems_max)
{
- if (xmlStrEqual (n->name, BAD_CAST "documentRule"))
- document_locating_rule_list_add (&rule.doc_rules, n);
+ rules->nitems_max = 2 * rules->nitems_max + 1;
+ rules->items =
+ xrealloc (rules->items,
+ sizeof (struct locating_rule_ty) * rules->nitems_max);
}
+ memcpy (&rules->items[rules->nitems++], &rule,
+ sizeof (struct locating_rule_ty));
}
- if (rules->nitems == rules->nitems_max)
- {
- rules->nitems_max = 2 * rules->nitems_max + 1;
- rules->items =
- xrealloc (rules->items,
- sizeof (struct locating_rule_ty) * rules->nitems_max);
- }
- memcpy (&rules->items[rules->nitems++], &rule,
- sizeof (struct locating_rule_ty));
}
}
line_buf[--len] = '\0';
/* Test if we have to ignore the line. */
- if (*line_buf == '\0' || *line_buf == '#')
- continue;
-
- add_languages (languages, desired_languages, line_buf, len);
+ if (!(*line_buf == '\0' || *line_buf == '#'))
+ /* Include the line among the languages. */
+ add_languages (languages, desired_languages, line_buf, len);
}
free (line_buf);
for (;;)
{
c = phase2_getc ();
- switch (c)
+ if (c == EOF || c == ']')
+ break;
+ if (c == '\n')
{
- default:
- /* Group names may contain all ASCII characters
- except for '[' and ']' and control characters. */
- if (!(c_isascii (c) && c != '[') && !c_iscntrl (c))
- break;
- APPEND (c);
- continue;
- case '\n':
po_xerror (PO_SEVERITY_WARNING, NULL,
real_file_name, gram_pos.line_number, 0, false,
_("unterminated group name"));
break;
- case EOF: case ']':
- break;
}
- break;
+ /* Group names may contain all ASCII characters
+ except for '[' and ']' and control characters. */
+ if (!(c_isascii (c) && c != '[') && !c_iscntrl (c))
+ break;
+ APPEND (c);
}
/* Skip until newline. */
while (c != '\n' && c != EOF)
for (;;)
{
c = phase2_getc ();
- switch (c)
- {
- default:
- APPEND (c);
- continue;
- case EOF: case '\n':
- break;
- }
- break;
+ if (c == EOF || c == '\n')
+ break;
+ APPEND (c);
}
APPEND (0);
tp->type = token_type_comment;
for (;;)
{
int c2 = phase2_getc ();
- switch (c2)
- {
- default:
- APPEND (c2);
- continue;
- case EOF: case ']':
- break;
- }
- break;
+ if (c2 == EOF || c2 == ']')
+ break;
+ APPEND (c2);
}
break;
c = phase2_getc ();
switch (c)
{
+ case ' ':
+ continue;
default:
- if (c == ' ')
- continue;
phase2_ungetc (c);
break;
case EOF: case '\n':
c = phase2_getc ();
switch (c)
{
+ case ' ':
+ continue;
default:
- if (c == ' ')
- continue;
phase2_ungetc (c);
break;
case EOF:
}
}
- if (start[j] != '\0')
- continue;
-
- /* Skip until the end marker. */
- for (;;)
- {
- int c;
-
- for (j = 0; end[j] != '\0'; j++)
- {
- assert (phase2_pushback_length + 1 < SIZEOF (phase2_pushback));
- c = phase2_getc ();
- if (c == UEOF)
- goto eof;
- if (c != end[j])
- {
- /* Don't push the first character back so the next
- iteration start from the second character. */
- if (j > 0)
- {
- int k = j;
+ if (start[j] == '\0')
+ /* Skip until the end marker. */
+ for (;;)
+ {
+ int c;
- phase2_ungetc (c);
- k--;
+ for (j = 0; end[j] != '\0'; j++)
+ {
+ assert (phase2_pushback_length + 1 < SIZEOF (phase2_pushback));
+ c = phase2_getc ();
+ if (c == UEOF)
+ goto eof;
+ if (c != end[j])
+ {
+ /* Don't push the first character back so the next
+ iteration start from the second character. */
+ if (j > 0)
+ {
+ int k = j;
- for (; k > 0; k--)
- phase2_ungetc (end[k]);
- }
- break;
- }
- }
+ phase2_ungetc (c);
+ k--;
- if (end[j] != '\0')
- continue;
+ for (; k > 0; k--)
+ phase2_ungetc (end[k]);
+ }
+ break;
+ }
+ }
- c = phase2_getc ();
- if (c == UEOF)
- goto eof;
- if (c != '>')
- {
- error_with_progname = false;
- error (0, 0,
- _("%s:%d: warning: %s is not allowed"),
- logical_file_name, line_number,
- end);
- error_with_progname = true;
- return false;
- }
- return true;
- }
+ if (end[j] == '\0')
+ {
+ c = phase2_getc ();
+ if (c == UEOF)
+ goto eof;
+ if (c != '>')
+ {
+ error_with_progname = false;
+ error (0, 0,
+ _("%s:%d: warning: %s is not allowed"),
+ logical_file_name, line_number,
+ end);
+ error_with_progname = true;
+ return false;
+ }
+ return true;
+ }
+ }
}
return false;
break;
/* Ignore leading spaces and tabs. */
- if (buflen == 0 && (c == ' ' || c == '\t'))
- continue;
-
- comment_add (c);
-
- switch (c)
+ if (!(buflen == 0 && (c == ' ' || c == '\t')))
{
- case ']':
- if (!right_bracket)
- {
- right_bracket = true;
- esigns2 = 0;
- }
- else
+ comment_add (c);
+
+ switch (c)
{
- if (esigns2 == esigns)
+ case ']':
+ if (!right_bracket)
{
- comment_line_end (2 + esigns);
- end = true;
+ right_bracket = true;
+ esigns2 = 0;
}
- }
- break;
+ else
+ {
+ if (esigns2 == esigns)
+ {
+ comment_line_end (2 + esigns);
+ end = true;
+ }
+ }
+ break;
- case '=':
- if (right_bracket)
- esigns2++;
- break;
+ case '=':
+ if (right_bracket)
+ esigns2++;
+ break;
- case '\n':
- comment_line_end (1);
- comment_start ();
- lineno = line_number;
- /* Intentionally not breaking. */
+ case '\n':
+ comment_line_end (1);
+ comment_start ();
+ lineno = line_number;
+ /* Intentionally not breaking. */
- default:
- right_bracket = false;
+ default:
+ right_bracket = false;
+ }
}
}
last_comment_line = lineno;