stdint-h
stdio-h
stdlib-h
+ streq
strtoimax
strtold
strtoul
str_startswith
strchrnul
strcspn
+ streq
strerror
string-desc
strnlen
stpncpy
str_startswith
strchrnul
+ streq
strerror
string-desc
strnlen
string_list_member (const string_list_ty *slp, const char *s)
{
for (size_t j = 0; j < slp->nitems; ++j)
- if (strcmp (slp->item[j], s) == 0)
+ if (streq (slp->item[j], s))
return 1;
return 0;
}
}
/* Keywords. */
- if (strcmp (ident, "and") == 0)
+ if (streq (ident, "and"))
{
arg->cp = exp;
sb_free (&buffer);
return AND;
}
- else if (strcmp (ident, "or") == 0)
+ else if (streq (ident, "or"))
{
arg->cp = exp;
sb_free (&buffer);
read_names_from_file (const char *file_name)
{
FILE *fp;
- if (strcmp (file_name, "-") == 0)
+ if (streq (file_name, "-"))
fp = stdin;
else
{
else if (*element == ',')
{
element++;
- if (strcmp (element, "short") == 0
- || strcmp (element, "medium") == 0
- || strcmp (element, "long") == 0
- || strcmp (element, "full") == 0
+ if (streq (element, "short")
+ || streq (element, "medium")
+ || streq (element, "long")
+ || streq (element, "full")
|| date_format_parse (element))
;
else
else if (*element == ',')
{
element++;
- if (strcmp (element, "currency") == 0
- || strcmp (element, "percent") == 0
- || strcmp (element, "integer") == 0
+ if (streq (element, "currency")
+ || streq (element, "percent")
+ || streq (element, "integer")
|| number_format_parse (element))
;
else
format_arg_type_t type_both;
if (((type1 == type2)
&& (type1 != FAT_FORMAT_STRING
- || strcmp (spec->numbered[i].signature,
- spec->numbered[j-1].signature) == 0))
+ || streq (spec->numbered[i].signature,
+ spec->numbered[j-1].signature)))
|| (((type1 | type2) & FAT_OPTIONAL_OCAML_SYNTAX) != 0
&& (((type1 & ~FAT_OPTIONAL_OCAML_SYNTAX) | FAT_OCAML_SYNTAX)
== ((type2 & ~FAT_OPTIONAL_OCAML_SYNTAX) | FAT_OCAML_SYNTAX))))
if (!(((type1 == type2)
&& (type1 != FAT_FORMAT_STRING
- || strcmp (spec1->numbered[i].signature,
- spec2->numbered[j].signature) == 0))
+ || streq (spec1->numbered[i].signature,
+ spec2->numbered[j].signature)))
|| ((type2 & FAT_OPTIONAL_OCAML_SYNTAX) != 0
&& (type2 & ~FAT_OPTIONAL_OCAML_SYNTAX)
== (type1 & ~FAT_OCAML_SYNTAX))))
/* Remove duplicates: Copy from i to j, keeping 0 <= j <= i. */
size_t i, j;
for (i = j = 0; i < spec.named_arg_count; i++)
- if (j > 0 && strcmp (spec.named[i].name, spec.named[j-1].name) == 0)
+ if (j > 0 && streq (spec.named[i].name, spec.named[j-1].name))
free (spec.named[i].name);
else
{
/* Remove duplicates: Copy from i to j, keeping 0 <= j <= i. */
size_t i, j;
for (i = j = 0; i < spec.named_arg_count; i++)
- if (j > 0 && strcmp (spec.named[i].name, spec.named[j-1].name) == 0)
+ if (j > 0 && streq (spec.named[i].name, spec.named[j-1].name))
free (spec.named[i].name);
else
{
bool err = false;
size_t i, j;
for (i = j = 0; i < spec.named_arg_count; i++)
- if (j > 0 && strcmp (spec.named[i].name, spec.named[j-1].name) == 0)
+ if (j > 0 && streq (spec.named[i].name, spec.named[j-1].name))
{
enum format_arg_type type1 = spec.named[i].type;
enum format_arg_type type2 = spec.named[j-1].type;
size_t i, j;
for (i = 0, j = 0; j < n2; )
{
- if (strcmp (spec1->named[i].name, spec2->named[j].name) == 0)
+ if (streq (spec1->named[i].name, spec2->named[j].name))
{
if (!(spec1->named[i].type == spec2->named[j].type
|| (!equality
bool err = false;
size_t i, j;
for (i = j = 0; i < spec.named_arg_count; i++)
- if (j > 0 && strcmp (spec.named[i].name, spec.named[j-1].name) == 0)
+ if (j > 0 && streq (spec.named[i].name, spec.named[j-1].name))
{
enum format_arg_type type1 = spec.named[i].type;
enum format_arg_type type2 = spec.named[j-1].type;
size_t i, j;
for (i = 0, j = 0; j < n2; )
{
- if (strcmp (spec1->named[i].name, spec2->named[j].name) == 0)
+ if (streq (spec1->named[i].name, spec2->named[j].name))
{
if (!(spec1->named[i].type == spec2->named[j].type))
{
/* Remove duplicates: Copy from i to j, keeping 0 <= j <= i. */
size_t i, j;
for (i = j = 0; i < spec.named_arg_count; i++)
- if (j > 0 && strcmp (spec.named[i].name, spec.named[j-1].name) == 0)
+ if (j > 0 && streq (spec.named[i].name, spec.named[j-1].name))
free (spec.named[i].name);
else
{
/* Remove duplicates: Copy from i to j, keeping 0 <= j <= i. */
size_t i, j;
for (i = j = 0; i < spec.named_arg_count; i++)
- if (j > 0 && strcmp (spec.named[i].name, spec.named[j-1].name) == 0)
+ if (j > 0 && streq (spec.named[i].name, spec.named[j-1].name))
free (spec.named[i].name);
else
{
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
for (size_t i = 0; i < values->nitems; i++)
{
struct its_value_ty *value = &values->items[i];
- if (strcmp (value->name, name) == 0)
+ if (streq (value->name, name))
return value->value;
}
return NULL;
for (i = 0; i < values->nitems; i++)
{
struct its_value_ty *_value = &values->items[i];
- if (strcmp (_value->name, name) == 0)
+ if (streq (_value->name, name))
{
free (_value->value);
_value->value = xstrdup (value);
{
struct its_value_ty *value = &values->items[j];
- if (strcmp (value->name, other_value->name) == 0
- && strcmp (value->value, other_value->value) != 0)
+ if (streq (value->name, other_value->name)
+ && !streq (value->value, other_value->value))
{
free (value->value);
value->value = xstrdup (other_value->value);
{
char *prop = _its_get_attribute (node, "space", NULL);
if (prop
- && !(strcmp (prop, "preserve") ==0
- || strcmp (prop, "default") == 0
+ && !(streq (prop, "preserve")
+ || streq (prop, "default")
/* gettext extension: remove leading/trailing whitespaces only. */
|| (node->ns && xmlStrEqual (node->ns->href, BAD_CAST GT_NS)
- && strcmp (prop, "trim") == 0)
+ && streq (prop, "trim"))
/* gettext extension: same as default except keeping
paragraph boundaries. */
|| (node->ns && xmlStrEqual (node->ns->href, BAD_CAST GT_NS)
- && strcmp (prop, "paragraph") == 0)))
+ && streq (prop, "paragraph"))))
{
error (0, 0, _("invalid attribute value \"%s\" for \"%s\""),
prop, "space");
if (xmlHasNsProp (node, BAD_CAST "escape", BAD_CAST GT_NS))
{
char *prop = _its_get_attribute (node, "escape", GT_NS);
- if (strcmp (prop, "yes") == 0 || strcmp (prop, "no") == 0)
+ if (streq (prop, "yes") || streq (prop, "no"))
{
its_value_list_append (result, "escape", prop);
- if (strcmp (prop, "no") != 0)
+ if (!streq (prop, "no"))
{
free (prop);
return result;
if (xmlHasNsProp (node, BAD_CAST "unescape-if", BAD_CAST GT_NS))
{
char *prop = _its_get_attribute (node, "unescape-if", GT_NS);
- if (strcmp (prop, "xml") == 0
- || strcmp (prop, "xhtml") == 0
- || strcmp (prop, "html") == 0
- || strcmp (prop, "no") == 0)
+ if (streq (prop, "xml")
+ || streq (prop, "xhtml")
+ || streq (prop, "html")
+ || streq (prop, "no"))
{
its_value_list_append (result, "unescape-if", prop);
- if (strcmp (prop, "no") != 0)
+ if (!streq (prop, "no"))
{
free (prop);
return result;
/* Check if NODE has translate="yes". */
{
const char *value = its_value_list_get_value (values, "translate");
- if (!(value && strcmp (value, "yes") == 0))
+ if (!(value && streq (value, "yes")))
{
its_value_list_destroy (values);
free (values);
if (depth > 0)
{
const char *value = its_value_list_get_value (values, "withinText");
- if (!(value && strcmp (value, "yes") == 0))
+ if (!(value && streq (value, "yes")))
{
its_value_list_destroy (values);
free (values);
bool do_escape;
{
const char *value = its_value_list_get_value (values, "escape");
- do_escape = value != NULL && strcmp (value, "yes") == 0;
+ do_escape = value != NULL && streq (value, "yes");
}
bool do_escape_during_extract = do_escape;
enum its_whitespace_type_ty whitespace;
{
const char *value = its_value_list_get_value (values, "space");
- if (value && strcmp (value, "preserve") == 0)
+ if (value && streq (value, "preserve"))
whitespace = ITS_WHITESPACE_PRESERVE;
- else if (value && strcmp (value, "trim") == 0)
+ else if (value && streq (value, "trim"))
whitespace = ITS_WHITESPACE_TRIM;
- else if (value && strcmp (value, "paragraph") == 0)
+ else if (value && streq (value, "paragraph"))
whitespace = ITS_WHITESPACE_NORMALIZE_PARAGRAPH;
else
whitespace = ITS_WHITESPACE_NORMALIZE;
attributes = attributes->next)
{
const xmlChar *attr_name = attributes->name;
- if (strcmp ((const char *) attr_name, "id") != 0)
+ if (!streq ((const char *) attr_name, "id"))
{
xmlNs *attr_ns = attributes->ns;
xmlChar *attr_value =
bool do_escape;
{
const char *value = its_value_list_get_value (values, "escape");
- do_escape = value != NULL && strcmp (value, "yes") == 0;
+ do_escape = value != NULL && streq (value, "yes");
}
bool do_escape_during_extract = do_escape;
enum its_whitespace_type_ty whitespace;
{
const char *value = its_value_list_get_value (values, "space");
- if (value && strcmp (value, "preserve") == 0)
+ if (value && streq (value, "preserve"))
whitespace = ITS_WHITESPACE_PRESERVE;
- else if (value && strcmp (value, "trim") == 0)
+ else if (value && streq (value, "trim"))
whitespace = ITS_WHITESPACE_TRIM;
- else if (value && strcmp (value, "paragraph") == 0)
+ else if (value && streq (value, "paragraph"))
whitespace = ITS_WHITESPACE_NORMALIZE_PARAGRAPH;
else
whitespace = ITS_WHITESPACE_NORMALIZE;
bool done_unescape = false;
if (do_unescape_if != NULL
- && ((strcmp (do_unescape_if, "xml") == 0
+ && ((streq (do_unescape_if, "xml")
&& _its_is_valid_simple_xml (msgstr))
- || (strcmp (do_unescape_if, "xhtml") == 0
+ || (streq (do_unescape_if, "xhtml")
&& _its_is_valid_simple_xhtml (msgstr))
- || (strcmp (do_unescape_if, "html") == 0
+ || (streq (do_unescape_if, "html")
&& _its_is_valid_simple_html (msgstr))))
{
/* It looks like the translator has provided a syntactically
translators most often only preserve the markup that was
present in the msgid; if they do this, the result will be
valid. */
- if (strcmp (do_unescape_if, "xml") == 0
- || strcmp (do_unescape_if, "xhtml") == 0)
+ if (streq (do_unescape_if, "xml")
+ || streq (do_unescape_if, "xhtml"))
{
if (_its_set_simple_xml_content (translated, msgstr))
done_unescape = true;
for (size_t j = 0; j < mp->filepos_count; j++)
{
lex_pos_ty *pp = &mp->filepos[j];
- if (strcmp (pp->file_name, file_name) == 0
+ if (streq (pp->file_name, file_name)
&& pp->line_number == line_number)
return;
}
message_ty *mp = mlp->item[j];
if ((msgctxt != NULL
- ? mp->msgctxt != NULL && strcmp (msgctxt, mp->msgctxt) == 0
+ ? mp->msgctxt != NULL && streq (msgctxt, mp->msgctxt)
: mp->msgctxt == NULL)
- && strcmp (msgid, mp->msgid) == 0)
+ && streq (msgid, mp->msgid))
return mp;
}
return NULL;
give mp a small advantage if mp is valid regardless of any context or
has the same context as the one being looked up. */
if (mp->msgctxt == NULL
- || (msgctxt != NULL && strcmp (msgctxt, mp->msgctxt) == 0))
+ || (msgctxt != NULL && streq (msgctxt, mp->msgctxt)))
{
bonus = 0.00001;
/* Since we will consider (weight + bonus) at the end, we are only
bool create)
{
for (size_t j = 0; j < mdlp->nitems; j++)
- if (strcmp (mdlp->item[j]->domain, domain) == 0)
+ if (streq (mdlp->item[j]->domain, domain))
return mdlp->item[j]->messages;
if (create)
/* Read input file. */
msgdomain_list_ty *result = read_catalog_file (input_file, input_syntax);
- if (strcmp (sub_name, "0") != 0)
+ if (!streq (sub_name, "0"))
{
/* Warn if the current locale is not suitable for this PO file. */
compare_po_locale_charsets (result);
static void
process_string (const message_ty *mp, const char *str, size_t len)
{
- if (strcmp (sub_name, "0") == 0)
+ if (streq (sub_name, "0"))
{
/* Built-in command "0". */
if (full_write (STDOUT_FILENO, str, len + 1) < len + 1)
}
/* Extra checks for sed scripts. */
- if (strcmp (sub_name, "sed") == 0)
+ if (streq (sub_name, "sed"))
{
if (sub_argc == 1)
error (EXIT_FAILURE, 0,
/* Replace GNU sed specific options with portable sed options. */
for (int i = 1; i < sub_argc; i++)
{
- if (strcmp (sub_argv[i], "--expression") == 0)
+ if (streq (sub_argv[i], "--expression"))
sub_argv[i] = "-e";
- else if (strcmp (sub_argv[i], "--file") == 0)
+ else if (streq (sub_argv[i], "--file"))
sub_argv[i] = "-f";
- else if (strcmp (sub_argv[i], "--quiet") == 0
- || strcmp (sub_argv[i], "--silent") == 0)
+ else if (streq (sub_argv[i], "--quiet")
+ || streq (sub_argv[i], "--silent"))
sub_argv[i] = "-n";
- if (strcmp (sub_argv[i], "-e") == 0
- || strcmp (sub_argv[i], "-f") == 0)
+ if (streq (sub_argv[i], "-e")
+ || streq (sub_argv[i], "-f"))
i++;
}
}
msgdomain_list_ty *result = read_catalog_file (input_file, input_syntax);
/* Recognize special programs as built-ins. */
- if (strcmp (sub_name, "recode-sr-latin") == 0 && sub_argc == 1)
+ if (streq (sub_name, "recode-sr-latin") && sub_argc == 1)
{
filter = serbian_to_latin;
result = iconv_msgdomain_list (result, po_charset_utf8, true, input_file,
textmode_xerror_handler);
}
- else if (strcmp (sub_name, "quot") == 0 && sub_argc == 1)
+ else if (streq (sub_name, "quot") && sub_argc == 1)
{
filter = ascii_quote_to_unicode;
result = iconv_msgdomain_list (result, po_charset_utf8, true, input_file,
textmode_xerror_handler);
}
- else if (strcmp (sub_name, "boldquot") == 0 && sub_argc == 1)
+ else if (streq (sub_name, "boldquot") && sub_argc == 1)
{
filter = ascii_quote_to_unicode_bold;
case CHAR_MAX + 13: /* --endianness={big|little} */
{
int endianness;
- if (strcmp (optarg, "big") == 0)
+ if (streq (optarg, "big"))
endianness = 1;
- else if (strcmp (optarg, "little") == 0)
+ else if (streq (optarg, "little"))
endianness = 0;
else
error (EXIT_FAILURE, 0, _("invalid endianness: %s"), optarg);
{
struct msg_domain **p_dom = &domain_list;
- while (*p_dom != NULL && strcmp (name, (*p_dom)->domain_name) != 0)
+ while (*p_dom != NULL && !streq (name, (*p_dom)->domain_name))
p_dom = &(*p_dom)->next;
if (*p_dom == NULL)
if (locale == NULL)
{
locale = gl_locale_name (LC_MESSAGES, "LC_MESSAGES");
- if (strcmp (locale, "C") == 0)
+ if (streq (locale, "C"))
{
const char *doc_url =
"https://www.gnu.org/software/gettext/manual/html_node/Setting-the-POSIX-Locale.html";
output_file = xasprintf ("%s.po", catalogname);
msgdomain_list_ty *result;
- if (strcmp (output_file, "-") != 0
+ if (!streq (output_file, "-")
&& access (output_file, F_OK) == 0)
{
/* The output PO file already exists. Assume the translator wants to
result = fill_header (result, true);
/* Initialize translations. */
- if (strcmp (language, "en") == 0)
+ if (streq (language, "en"))
result = msgdomain_list_english (result);
else
result = update_msgstr_plurals (result);
/* If the territory is the language's principal territory, drop it. */
for (size_t i = 0; i < SIZEOF (locales_with_principal_territory); i++)
- if (strcmp (locale, locales_with_principal_territory[i]) == 0)
+ if (streq (locale, locales_with_principal_territory[i]))
{
const char *language_end = strchr (locale, '_');
if (language_end == NULL)
englishname_of_language ()
{
for (size_t i = 0; i < language_table_size; i++)
- if (strcmp (language_table[i].code, language) == 0)
+ if (streq (language_table[i].code, language))
return language_table[i].english;
return xasprintf ("Language %s", language);
it was already filled in by xgettext. */
{
const char *old_field = get_field (header, "Project-Id-Version");
- if (old_field != NULL && strcmp (old_field, "PACKAGE VERSION") != 0)
+ if (old_field != NULL && !streq (old_field, "PACKAGE VERSION"))
{
/* Remove the last word from old_field. */
const char *last_space = strrchr (old_field, ' ');
xgettext. */
{
const char *old_field = get_field (header, "Project-Id-Version");
- if (old_field != NULL && strcmp (old_field, "PACKAGE VERSION") != 0)
+ if (old_field != NULL && !streq (old_field, "PACKAGE VERSION"))
return old_field;
}
{
/* Search for a name depending on the catalogname. */
for (size_t i = 0; i < language_variant_table_size; i++)
- if (strcmp (language_variant_table[i].code, catalogname) == 0)
+ if (streq (language_variant_table[i].code, catalogname))
return language_variant_table[i].english;
/* Search for a name depending on the language only. */
{
/* Search for a formula depending on the catalogname. */
for (size_t i = 0; i < plural_table_size; i++)
- if (strcmp (plural_table[i].lang, catalogname) == 0)
+ if (streq (plural_table[i].lang, catalogname))
return plural_table[i].value;
/* Search for a formula depending on the language only. */
for (size_t i = 0; i < plural_table_size; i++)
- if (strcmp (plural_table[i].lang, language) == 0)
+ if (streq (plural_table[i].lang, language))
return plural_table[i].value;
const char *gettextcldrdir = getenv ("GETTEXTCLDRDIR");
*not* "Traduzioni inglesi ...". */
const char *msgid = N_("English translations for %s package");
result = gettext (msgid);
- if (result != msgid && strcmp (result, msgid) != 0)
+ if (result != msgid && !streq (result, msgid))
/* Use the English and the foreign title. */
result = xasprintf ("%s\n%s", english,
xstr_iconv (result, locale_charset (),
const char *filename = files[n];
size_t filenamelen = strlen (filename);
- if (strcmp (charset, "CHARSET") == 0
+ if (streq (charset, "CHARSET")
&& ((filenamelen >= 4
&& memeq (filename + filenamelen - 4,
".pot", 4))
with spaces are present in the target encoding. */
if (has_filenames_with_spaces
&& !(canon_to_code == po_charset_utf8
- || strcmp (canon_to_code, "GB18030") == 0))
+ || streq (canon_to_code, "GB18030")))
error (EXIT_FAILURE, 0,
_("Cannot write the control characters that protect file names with spaces in the %s encoding"),
canon_to_code);
else if (canon_charsets[n][k] != first && second == NULL)
second = canon_charsets[n][k];
- if (strcmp (canon_charsets[n][k], "UTF-8") == 0)
+ if (streq (canon_charsets[n][k], "UTF-8"))
with_UTF8 = true;
if (!po_charset_ascii_compatible (canon_charsets[n][k]))
/* A conversion is needed. Warn the user since he hasn't asked
for it and might be surprised. */
if (first != NULL
- && (first == po_charset_utf8 || strcmp (first, "GB18030") == 0))
+ && (first == po_charset_utf8 || streq (first, "GB18030")))
canon_to_code = first;
else
canon_to_code = po_charset_utf8;
/* "CHARSET" is often used as a placeholder, equivalent
to "any" or "ASCII". */
- if (!(strcmp (charset, "CHARSET") == 0)
+ if (!streq (charset, "CHARSET")
&& canon_charset == NULL)
error (EXIT_FAILURE, 0,
_("%s: The present charset \"%s\" is not a portable encoding name."),
then apply '%s',\n\
then convert back to %s using 'msgconv'.\n\
"), canon_locale_code, last_component (program_name), canon_charset));
- if (strcmp (canon_charset, "UTF-8") != 0
+ if (!streq (canon_charset, "UTF-8")
&& (canon_locale_code == NULL
- || strcmp (canon_locale_code, "UTF-8") != 0))
+ || !streq (canon_locale_code, "UTF-8")))
multiline_append (prefix_width,
xasprintf (_("\
- Set LC_ALL to a locale with encoding %s,\n\
pos_equal (const lex_pos_ty *pos1, const lex_pos_ty *pos2)
{
return ((pos1->file_name == pos2->file_name
- || strcmp (pos1->file_name, pos2->file_name) == 0)
+ || streq (pos1->file_name, pos2->file_name))
&& pos1->line_number == pos2->line_number);
}
if (i1 != i2)
return false;
for (size_t i = 0; i < i1; i++)
- if (strcmp (slp1->item[i], slp2->item[i]) != 0)
+ if (!streq (slp1->item[i], slp2->item[i]))
return false;
return true;
}
bool ignore_potcdate)
{
if (!(mp1->msgctxt != NULL
- ? mp2->msgctxt != NULL && strcmp (mp1->msgctxt, mp2->msgctxt) == 0
+ ? mp2->msgctxt != NULL && streq (mp1->msgctxt, mp2->msgctxt)
: mp2->msgctxt == NULL))
return false;
- if (strcmp (mp1->msgid, mp2->msgid) != 0)
+ if (!streq (mp1->msgid, mp2->msgid))
return false;
if (!(mp1->msgid_plural != NULL
? mp2->msgid_plural != NULL
- && strcmp (mp1->msgid_plural, mp2->msgid_plural) == 0
+ && streq (mp1->msgid_plural, mp2->msgid_plural)
: mp2->msgid_plural == NULL))
return false;
if (!(mp1->prev_msgctxt != NULL
? mp2->prev_msgctxt != NULL
- && strcmp (mp1->prev_msgctxt, mp2->prev_msgctxt) == 0
+ && streq (mp1->prev_msgctxt, mp2->prev_msgctxt)
: mp2->prev_msgctxt == NULL))
return false;
if (!(mp1->prev_msgid != NULL
? mp2->prev_msgid != NULL
- && strcmp (mp1->prev_msgid, mp2->prev_msgid) == 0
+ && streq (mp1->prev_msgid, mp2->prev_msgid)
: mp2->prev_msgid == NULL))
return false;
if (!(mp1->prev_msgid_plural != NULL
? mp2->prev_msgid_plural != NULL
- && strcmp (mp1->prev_msgid_plural, mp2->prev_msgid_plural) == 0
+ && streq (mp1->prev_msgid_plural, mp2->prev_msgid_plural)
: mp2->prev_msgid_plural == NULL))
return false;
msgdomain_equal (const msgdomain_ty *mdp1, const msgdomain_ty *mdp2,
bool ignore_potcdate)
{
- return (strcmp (mdp1->domain, mdp2->domain) == 0
+ return (streq (mdp1->domain, mdp2->domain)
&& message_list_equal (mdp1->messages, mdp2->messages,
ignore_potcdate));
}
/* Search the field in known_fields[]. */
int field_index = -1;
for (size_t k = 0; k < SIZEOF (known_fields); k++)
- if (strcmp (known_fields[k].name, field) == 0)
+ if (streq (known_fields[k].name, field))
{
field_index = k;
break;
const char *filename = from_filename;
size_t filenamelen;
- if (strcmp (charset, "CHARSET") == 0
+ if (streq (charset, "CHARSET")
&& ((filename != NULL
&& (filenamelen = strlen (filename)) >= 4
&& memeq (filename + filenamelen - 4, ".pot", 4))
spaces are present in the target encoding. */
if (msgdomain_list_has_filenames_with_spaces (mdlp)
&& !(canon_to_code == po_charset_utf8
- || strcmp (canon_to_code, "GB18030") == 0))
+ || streq (canon_to_code, "GB18030")))
xeh->xerror (CAT_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
xasprintf (_("Cannot write the control characters that protect file names with spaces in the %s encoding"),
canon_to_code));
{
/* Don't give an error for POT files, because POT
files usually contain only ASCII msgids. */
- if (strcmp (charset, "CHARSET") == 0)
+ if (streq (charset, "CHARSET"))
canon_charset = po_charset_ascii;
else
{
if (!result->is_fuzzy
&& (ref->msgid_plural != NULL
? def->msgid_plural == NULL
- || strcmp (ref->msgid_plural, def->msgid_plural) != 0
+ || !streq (ref->msgid_plural, def->msgid_plural)
: def->msgid_plural != NULL))
result->is_fuzzy = true;
error (EXIT_FAILURE, 0, _("too many arguments"));
/* Check --species option. */
- if (strcmp (species, "ollama") != 0)
+ if (!streq (species, "ollama"))
error (EXIT_FAILURE, 0, _("invalid value for %s option: %s"),
"--species", species);
static FILE *
try_open_catalog_file (const char *input_name, char **real_file_name_p)
{
- if (strcmp (input_name, "-") == 0 || strcmp (input_name, "/dev/stdin") == 0)
+ if (streq (input_name, "-") || streq (input_name, "/dev/stdin"))
{
*real_file_name_p = xstrdup (_("<stdin>"));
return stdin;
po_charset_ascii_compatible (const char *canon_charset)
{
/* There are only a few exceptions to ASCII compatibility. */
- if (strcmp (canon_charset, "SHIFT_JIS") == 0
- || strcmp (canon_charset, "JOHAB") == 0
- || strcmp (canon_charset, "VISCII") == 0)
+ if (streq (canon_charset, "SHIFT_JIS")
+ || streq (canon_charset, "JOHAB")
+ || streq (canon_charset, "VISCII"))
return false;
else
return true;
};
for (size_t i = 0; i < SIZEOF (weird_charsets); i++)
- if (strcmp (canon_charset, weird_charsets[i]) == 0)
+ if (streq (canon_charset, weird_charsets[i]))
return true;
return false;
}
};
for (size_t i = 0; i < SIZEOF (weird_cjk_charsets); i++)
- if (strcmp (canon_charset, weird_cjk_charsets[i]) == 0)
+ if (streq (canon_charset, weird_cjk_charsets[i]))
return true;
return false;
}
{
if (canon_charset == utf8)
return utf8_character_iterator;
- if (strcmp (canon_charset, "GB2312") == 0
- || strcmp (canon_charset, "EUC-KR") == 0)
+ if (streq (canon_charset, "GB2312")
+ || streq (canon_charset, "EUC-KR"))
return euc_character_iterator;
- if (strcmp (canon_charset, "EUC-JP") == 0)
+ if (streq (canon_charset, "EUC-JP"))
return euc_jp_character_iterator;
- if (strcmp (canon_charset, "EUC-TW") == 0)
+ if (streq (canon_charset, "EUC-TW"))
return euc_tw_character_iterator;
- if (strcmp (canon_charset, "BIG5") == 0)
+ if (streq (canon_charset, "BIG5"))
return big5_character_iterator;
- if (strcmp (canon_charset, "BIG5-HKSCS") == 0)
+ if (streq (canon_charset, "BIG5-HKSCS"))
return big5hkscs_character_iterator;
- if (strcmp (canon_charset, "GBK") == 0)
+ if (streq (canon_charset, "GBK"))
return gbk_character_iterator;
- if (strcmp (canon_charset, "GB18030") == 0)
+ if (streq (canon_charset, "GB18030"))
return gb18030_character_iterator;
- if (strcmp (canon_charset, "SHIFT_JIS") == 0)
+ if (streq (canon_charset, "SHIFT_JIS"))
return shift_jis_character_iterator;
- if (strcmp (canon_charset, "JOHAB") == 0)
+ if (streq (canon_charset, "JOHAB"))
return johab_character_iterator;
return char_iterator;
}
/* Specification. */
#include "read-csharp.h"
+#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
-#include <errno.h>
+#include <string.h>
#include <error.h>
#include "msgunfmt.h"
char *p = strchr (culture_name, '@');
if (p != NULL)
{
- if (strcmp (p, "@latin") == 0)
+ if (streq (p, "@latin"))
strcpy (p, "-Latn");
- else if (strcmp (p, "@cyrillic") == 0)
+ else if (streq (p, "@cyrillic"))
strcpy (p, "-Cyrl");
}
- if (strcmp (culture_name, "sr-SP") == 0)
+ if (streq (culture_name, "sr-SP"))
{
free (culture_name);
culture_name = xstrdup ("sr-SP-Latn");
}
- else if (strcmp (culture_name, "uz-UZ") == 0)
+ else if (streq (culture_name, "uz-UZ"))
{
free (culture_name);
culture_name = xstrdup ("uz-UZ-Latn");
static lex_pos_ty pos = { __FILE__, __LINE__ };
FILE *fp;
- if (strcmp (filename, "-") == 0 || strcmp (filename, "/dev/stdin") == 0)
+ if (streq (filename, "-") || streq (filename, "/dev/stdin"))
{
fp = stdin;
SET_BINARY (fileno (fp));
only ASCII msgids. */
size_t filenamelen = strlen (filename);
- if (!(strcmp (charset, "CHARSET") == 0
+ if (!(streq (charset, "CHARSET")
&& ((filenamelen >= 4
&& memeq (filename + filenamelen - 4, ".pot", 4))
|| is_pot_role)))
{
ps->po_lex_charset = canon_charset;
- if (strcmp (canon_charset, "UTF-8") == 0)
+ if (streq (canon_charset, "UTF-8"))
{
ps->catr->po_lex_isolate_start = "\xE2\x81\xA8";
ps->catr->po_lex_isolate_end = "\xE2\x81\xA9";
}
- else if (strcmp (canon_charset, "GB18030") == 0)
+ else if (streq (canon_charset, "GB18030"))
{
ps->catr->po_lex_isolate_start = "\x81\x36\xAC\x34";
ps->catr->po_lex_isolate_end = "\x81\x36\xAC\x35";
{
if (!ps->po_lex_previous)
{
- if (!strcmp (s, "domain"))
+ if (streq (s, "domain"))
return DOMAIN;
- if (!strcmp (s, "msgid"))
+ if (streq (s, "msgid"))
return MSGID;
- if (!strcmp (s, "msgid_plural"))
+ if (streq (s, "msgid_plural"))
return MSGID_PLURAL;
- if (!strcmp (s, "msgstr"))
+ if (streq (s, "msgstr"))
return MSGSTR;
- if (!strcmp (s, "msgctxt"))
+ if (streq (s, "msgctxt"))
return MSGCTXT;
}
else
{
/* Inside a "#|" context, the keywords have a different meaning. */
- if (!strcmp (s, "msgid"))
+ if (streq (s, "msgid"))
return PREV_MSGID;
- if (!strcmp (s, "msgid_plural"))
+ if (streq (s, "msgid_plural"))
return PREV_MSGID_PLURAL;
- if (!strcmp (s, "msgctxt"))
+ if (streq (s, "msgctxt"))
return PREV_MSGCTXT;
}
po_gram_error_at_line (ps->catr, &ps->gram_pos,
char *line = conv_from_ucs4 (buffer, buflen);
- if (strcmp (line, "Flag: untranslated") == 0)
+ if (streq (line, "Flag: untranslated"))
{
special_comment_add ("fuzzy");
next_is_fuzzy = true;
}
- else if (strcmp (line, "Flag: unmatched") == 0)
+ else if (streq (line, "Flag: unmatched"))
next_is_obsolete = true;
else if (strlen (line) >= 6 && memeq (line, "Flag: ", 6))
special_comment_add (line + 6);
phase4_ungetc (c);
expect_fuzzy_msgstr_as_cxx_comment = false;
}
- if (fuzzy_msgstr != NULL && strcmp (msgstr, msgid) == 0)
+ if (fuzzy_msgstr != NULL && streq (msgstr, msgid))
msgstr = fuzzy_msgstr;
/* A key/value pair. */
englishname_of_language (const char *language)
{
for (size_t i = 0; i < language_table_size; i++)
- if (strcmp (language_table[i].code, language) == 0)
+ if (streq (language_table[i].code, language))
return language_table[i].english;
return NULL;
englishname_of_country (const char *country)
{
for (size_t i = 0; i < country_table_size; i++)
- if (strcmp (country_table[i].code, country) == 0)
+ if (streq (country_table[i].code, country))
return country_table[i].english;
return NULL;
{
/* Treat a few cases specially. */
for (size_t i = 0; i < language_variant_table_size; i++)
- if (strcmp (language_variant_table[i].code, catalogname) == 0)
+ if (streq (language_variant_table[i].code, catalogname))
return language_variant_table[i].english;
/* Decompose "ll_CC" into "ll" and "CC". */
error (EXIT_FAILURE, 0, _("too many arguments"));
/* Check --species option. */
- if (strcmp (species, "ollama") != 0)
+ if (!streq (species, "ollama"))
error (EXIT_FAILURE, 0, _("invalid value for %s option: %s"),
"--species", species);
{
/* Do nothing if the string is already in the list. */
for (size_t j = 0; j < slp->nitems; ++j)
- if (strcmp (slp->item[j], s) == 0)
+ if (streq (slp->item[j], s))
return;
/* Grow the list. */
string_list_member (const string_list_ty *slp, const char *s)
{
for (size_t j = 0; j < slp->nitems; ++j)
- if (strcmp (slp->item[j], s) == 0)
+ if (streq (slp->item[j], s))
return true;
return false;
}
string_list_remove (string_list_ty *slp, const char *s)
{
for (size_t j = 0; j < slp->nitems; ++j)
- if (strcmp (slp->item[j], s) == 0)
+ if (streq (slp->item[j], s))
{
const char *found = slp->item[j];
if (slp->nitems > j + 1)
}
}
- bool to_stdout = (filename == NULL || strcmp (filename, "-") == 0
- || strcmp (filename, "/dev/stdout") == 0);
+ bool to_stdout = (filename == NULL || streq (filename, "-")
+ || streq (filename, "/dev/stdout"));
#if ENABLE_COLOR
if (output_syntax->supports_color
p = strchr (culture_name, '@');
if (p != NULL)
{
- if (strcmp (p, "@latin") == 0)
+ if (streq (p, "@latin"))
strcpy (p, "-Latn");
- else if (strcmp (p, "@cyrillic") == 0)
+ else if (streq (p, "@cyrillic"))
strcpy (p, "-Cyrl");
}
- if (strcmp (culture_name, "sr-SP") == 0)
+ if (streq (culture_name, "sr-SP"))
{
free (culture_name);
culture_name = xstrdup ("sr-SP-Latn");
}
- else if (strcmp (culture_name, "uz-UZ") == 0)
+ else if (streq (culture_name, "uz-UZ"))
{
free (culture_name);
culture_name = xstrdup ("uz-UZ-Latn");
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <error.h>
#include "msgl-iconv.h"
msgfmt_reader->operands = operands;
msgfmt_reader->keywords = keywords;
- if (strcmp (file_name, "-") == 0)
+ if (streq (file_name, "-"))
msgfmt_reader->output_file = stdout;
else
{
between builds in the same conditions. */
message_list_delete_header_field (mlp, "POT-Creation-Date:");
- if (strcmp (domain_name, "-") == 0)
+ if (streq (domain_name, "-"))
{
FILE *output_file = stdout;
SET_BINARY (fileno (output_file));
size_t j;
for (j = 0; j < filepos_count; j++)
- if (strcmp (filepos[j].file_name, pp->file_name) == 0)
+ if (streq (filepos[j].file_name, pp->file_name))
break;
if (j == filepos_count)
ostream_write_str (stream, "\xE2\x81\xA9"); /* U+2069 */
}
else if (canon_charset != NULL
- && strcmp (canon_charset, "GB18030") == 0)
+ && streq (canon_charset, "GB18030"))
{
ostream_write_str (stream, "\x81\x36\xAC\x34"); /* U+2068 */
ostream_write_str (stream, cp);
{
if (option != NULL)
{
- if (strcmp (option, "never") == 0 || strcmp (option, "no") == 0)
+ if (streq (option, "never") || streq (option, "no"))
message_print_style_filepos (filepos_comment_none);
- else if (strcmp (option, "full") == 0 || strcmp (option, "yes") == 0)
+ else if (streq (option, "full") || streq (option, "yes"))
message_print_style_filepos (filepos_comment_full);
- else if (strcmp (option, "file") == 0)
+ else if (streq (option, "file"))
message_print_style_filepos (filepos_comment_file);
else
{
/* If the first domain is the default, don't bother emitting
the domain name, because it is the default. */
if (!(k == 0
- && strcmp (mdlp->item[k]->domain, MESSAGE_DOMAIN_DEFAULT) == 0))
+ && streq (mdlp->item[k]->domain, MESSAGE_DOMAIN_DEFAULT)))
{
if (blank_line)
print_blank_line (stream);
charset = allocated_charset;
/* Treat the dummy default value as if it were absent. */
- if (strcmp (charset, "CHARSET") == 0)
+ if (streq (charset, "CHARSET"))
charset = "ASCII";
}
}
message_list_delete_header_field (mlp, "POT-Creation-Date:");
FILE *output_file;
- if (strcmp (domain_name, "-") == 0)
+ if (streq (domain_name, "-"))
{
output_file = stdout;
SET_BINARY (fileno (output_file));
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <error.h>
#include "msgl-iconv.h"
const char *file_name)
{
FILE *fp;
- if (strcmp (file_name, "-") == 0)
+ if (streq (file_name, "-"))
fp = stdout;
else
{
echo; echo $k; awk "function foo () { $k / 10 }" < /dev/null
done
*/
- if (strcmp (tp->string, "do") == 0
- || strcmp (tp->string, "exit") == 0
- || strcmp (tp->string, "print") == 0
- || strcmp (tp->string, "printf") == 0
- || strcmp (tp->string, "return") == 0)
+ if (streq (tp->string, "do")
+ || streq (tp->string, "exit")
+ || streq (tp->string, "print")
+ || streq (tp->string, "printf")
+ || streq (tp->string, "return"))
prefer_division_over_regexp = false;
else
prefer_division_over_regexp = true;
state = 0;
}
next_is_argument =
- (strcmp (token.string, "print") == 0
- || strcmp (token.string, "printf") == 0);
+ (streq (token.string, "print")
+ || streq (token.string, "printf"));
next_context_iter =
flag_context_list_iterator (
flag_context_list_table_lookup (
normal input. */
if (bufpos == 0
&& tp->type == token_type_name
- && strcmp (tp->string, "define") == 0)
+ && streq (tp->string, "define"))
return;
/* Accumulate. */
/* If it is a #line directive, with no macros to expand, act on
it. Ignore all other directives. */
if (bufpos >= 3 && buf[0].type == token_type_name
- && strcmp (buf[0].string, "line") == 0
+ && streq (buf[0].string, "line")
&& buf[1].type == token_type_number
&& buf[2].type == token_type_string_literal)
{
/* A package is imported without a name.
The package_shortname is the last element of the path, except in
special cases. */
- if (strcmp (path, SNAPCORE_PACKAGE_FULLNAME) == 0)
+ if (streq (path, SNAPCORE_PACKAGE_FULLNAME))
shortname = sd_from_c (SNAPCORE_PACKAGE_SHORTNAME);
else
{
for (size_t i = 0; i < unqualified_packages.nitems; i++)
{
const char *unqualified_package = unqualified_packages.item[i];
- if (strcmp (unqualified_package, GOTEXT_PACKAGE_FULLNAME) == 0)
+ if (streq (unqualified_package, GOTEXT_PACKAGE_FULLNAME))
{
if (hash_find_entry (&gotext_package.defined_types,
sd_data (type_name), sd_length (type_name),
== 0)
return (go_type_t *) found_type;
}
- else if (strcmp (unqualified_package, SNAPCORE_PACKAGE_FULLNAME) == 0)
+ else if (streq (unqualified_package, SNAPCORE_PACKAGE_FULLNAME))
{
if (hash_find_entry (&snapcore_package.defined_types,
sd_data (type_name), sd_length (type_name),
&found_package)
== 0)
{
- if (strcmp ((const char *) found_package, GOTEXT_PACKAGE_FULLNAME) == 0)
+ if (streq ((const char *) found_package, GOTEXT_PACKAGE_FULLNAME))
{
/* Look up the type. */
TSNode name_node = ts_node_child_by_field_id (type_node, ts_field_name);
== 0)
return (go_type_t *) found_type;
}
- else if (strcmp ((const char *) found_package, SNAPCORE_PACKAGE_FULLNAME) == 0)
+ else if (streq ((const char *) found_package, SNAPCORE_PACKAGE_FULLNAME))
{
/* Look up the type. */
TSNode name_node = ts_node_child_by_field_id (type_node, ts_field_name);
for (size_t i = 0; i < unqualified_packages.nitems; i++)
{
const char *unqualified_package = unqualified_packages.item[i];
- if (strcmp (unqualified_package, GOTEXT_PACKAGE_FULLNAME) == 0)
+ if (streq (unqualified_package, GOTEXT_PACKAGE_FULLNAME))
{
if (hash_find_entry (&gotext_package.globals,
sd_data (var_name), sd_length (var_name),
== 0)
return (go_type_t *) found_type;
}
- else if (strcmp (unqualified_package, SNAPCORE_PACKAGE_FULLNAME) == 0)
+ else if (streq (unqualified_package, SNAPCORE_PACKAGE_FULLNAME))
{
if (hash_find_entry (&snapcore_package.globals,
sd_data (var_name), sd_length (var_name),
{
unsigned int n = type1->u.struct_def.n_members;
for (unsigned int i = 0; i < n; i++)
- if (strcmp (type1->u.struct_def.members[i].name,
- type2->u.struct_def.members[i].name) != 0)
+ if (!streq (type1->u.struct_def.members[i].name,
+ type2->u.struct_def.members[i].name))
return false;
for (unsigned int i = 0; i < n; i++)
if (!type_equals (type1->u.struct_def.members[i].type,
{
unsigned int n = type1->u.struct_def.n_methods;
for (unsigned int i = 0; i < n; i++)
- if (strcmp (type1->u.struct_def.methods[i].name,
- type2->u.struct_def.methods[i].name) != 0)
+ if (!streq (type1->u.struct_def.methods[i].name,
+ type2->u.struct_def.methods[i].name))
return false;
for (unsigned int i = 0; i < n; i++)
if (!type_equals (type1->u.struct_def.methods[i].type,
{
unsigned int n = type1->u.interface_def.n_methods;
for (unsigned int i = 0; i < n; i++)
- if (strcmp (type1->u.interface_def.methods[i].name,
- type2->u.interface_def.methods[i].name) != 0)
+ if (!streq (type1->u.interface_def.methods[i].name,
+ type2->u.interface_def.methods[i].name))
return false;
for (unsigned int i = 0; i < n; i++)
if (!type_equals (type1->u.interface_def.methods[i].type,
== 0)
{
/* The operand is a package name. */
- if (strcmp ((const char *) found_package, GOTEXT_PACKAGE_FULLNAME) == 0)
+ if (streq ((const char *) found_package, GOTEXT_PACKAGE_FULLNAME))
{
/* Look up the entity in the package. */
void *found_type;
== 0)
return1 ((go_type_t *) found_type);
}
- else if (strcmp ((const char *) found_package, SNAPCORE_PACKAGE_FULLNAME) == 0)
+ else if (streq ((const char *) found_package, SNAPCORE_PACKAGE_FULLNAME))
{
/* Look up the entity in the package. */
void *found_type;
{
qualified_identifier = true;
/* The operand is a package name. */
- if (strcmp ((const char *) found_package, GOTEXT_PACKAGE_FULLNAME) == 0)
+ if (streq ((const char *) found_package, GOTEXT_PACKAGE_FULLNAME))
{
/* Look in the gotext_keywords table. */
void *keyword_value;
== 0)
next_shapes = (const struct callshapes *) keyword_value;
}
- else if (strcmp ((const char *) found_package, SNAPCORE_PACKAGE_FULLNAME) == 0)
+ else if (streq ((const char *) found_package, SNAPCORE_PACKAGE_FULLNAME))
{
/* Look in the snapcore_keywords table. */
void *keyword_value;
java-printf-format, whereas in
foobar (EXPR).formatted()
they should not. */
- if (strcmp (sum, "return") != 0)
+ if (!streq (sum, "return"))
{
for (const char *dottedname = sum;;)
{
token_ty token3;
x_java_lex (&token3);
if (token3.type == token_type_symbol
- && strcmp (token3.string, "formatted") == 0)
+ && streq (token3.string, "formatted"))
{
/* Mark the messages found in the region as java-printf-format
a posteriori. */
static tag_step1_fn
get_tag_step1_fn (const char *format)
{
- if (strcmp (format, "javascript-gnome-format") == 0)
+ if (streq (format, "javascript-gnome-format"))
return gnome_step1;
/* ... More formats can be added here ... */
return NULL;
break;
}
tp->string = sb_xdupfree_c (&buffer);
- if (strcmp (tp->string, "return") == 0
- || strcmp (tp->string, "else") == 0)
+ if (streq (tp->string, "return")
+ || streq (tp->string, "else"))
tp->type = last_token_type = token_type_keyword;
else
tp->type = last_token_type = token_type_symbol;
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#define SB_NO_APPENDF
#include <error.h>
phase1_ungetc (c);
const char *contents = sb_xcontents_c (&buffer);
- if (strcmp (contents, "not") == 0)
+ if (streq (contents, "not"))
{
sb_free (&buffer);
tp->type = token_type_operator1;
}
- else if (strcmp (contents, "and") == 0)
+ else if (streq (contents, "and"))
{
sb_free (&buffer);
tp->type = token_type_operator2;
}
- else if (strcmp (contents, "or") == 0)
+ else if (streq (contents, "or"))
{
sb_free (&buffer);
tp->type = token_type_operator2;
}
/* See whether this line terminates the here document. */
- if (strcmp (my_linebuf, delimiter) == 0)
+ if (streq (my_linebuf, delimiter))
break;
/* Add back the trailing newline to my_linebuf. */
}
const char *contents = sb_xcontents_c (&buffer);
- if (strcmp (contents, "__END__") == 0
- || strcmp (contents, "__DATA__") == 0)
+ if (streq (contents, "__END__")
+ || streq (contents, "__DATA__"))
{
sb_free (&buffer);
xp->end_of_file = true;
tp->type = token_type_eof;
return;
}
- else if (strcmp (contents, "and") == 0
- || strcmp (contents, "cmp") == 0
- || strcmp (contents, "eq") == 0
- || strcmp (contents, "if") == 0
- || strcmp (contents, "ge") == 0
- || strcmp (contents, "gt") == 0
- || strcmp (contents, "le") == 0
- || strcmp (contents, "lt") == 0
- || strcmp (contents, "ne") == 0
- || strcmp (contents, "not") == 0
- || strcmp (contents, "or") == 0
- || strcmp (contents, "unless") == 0
- || strcmp (contents, "while") == 0
- || strcmp (contents, "xor") == 0)
+ else if (streq (contents, "and")
+ || streq (contents, "cmp")
+ || streq (contents, "eq")
+ || streq (contents, "if")
+ || streq (contents, "ge")
+ || streq (contents, "gt")
+ || streq (contents, "le")
+ || streq (contents, "lt")
+ || streq (contents, "ne")
+ || streq (contents, "not")
+ || streq (contents, "or")
+ || streq (contents, "unless")
+ || streq (contents, "while")
+ || streq (contents, "xor"))
{
tp->type = token_type_named_op;
tp->string = sb_xdupfree_c (&buffer);
return;
}
- else if (strcmp (contents, "s") == 0
- || strcmp (contents, "y") == 0
- || strcmp (contents, "tr") == 0)
+ else if (streq (contents, "s")
+ || streq (contents, "y")
+ || streq (contents, "tr"))
{
int delim = phase1_getc (xp);
phase1_ungetc (xp, c);
return;
}
- else if (strcmp (contents, "m") == 0)
+ else if (streq (contents, "m"))
{
int delim = phase1_getc (xp);
phase1_ungetc (xp, c);
return;
}
- else if (strcmp (contents, "qq") == 0
- || strcmp (contents, "q") == 0
- || strcmp (contents, "qx") == 0
- || strcmp (contents, "qw") == 0
- || strcmp (contents, "qr") == 0)
+ else if (streq (contents, "qq")
+ || streq (contents, "q")
+ || streq (contents, "qx")
+ || streq (contents, "qw")
+ || streq (contents, "qr"))
{
/* The qw (...) construct is not really a string but we
can treat in the same manner and then pretend it is
return;
}
tp->type = token_type_symbol;
- tp->sub_type = (strcmp (contents, "sub") == 0
+ tp->sub_type = (streq (contents, "sub")
? symbol_type_sub
: symbol_type_none);
tp->string = sb_xdupfree_c (&buffer);
/* Instance method, not chained. */
xp->last_token_type = token_type_variable;
}
- else if (strcmp (tp->string, "wantarray") == 0
- || strcmp (tp->string, "fork") == 0
- || strcmp (tp->string, "getlogin") == 0
- || strcmp (tp->string, "getppid") == 0
- || strcmp (tp->string, "getpwent") == 0
- || strcmp (tp->string, "getgrent") == 0
- || strcmp (tp->string, "gethostent") == 0
- || strcmp (tp->string, "getnetent") == 0
- || strcmp (tp->string, "getprotoent") == 0
- || strcmp (tp->string, "getservent") == 0
- || strcmp (tp->string, "setpwent") == 0
- || strcmp (tp->string, "setgrent") == 0
- || strcmp (tp->string, "endpwent") == 0
- || strcmp (tp->string, "endgrent") == 0
- || strcmp (tp->string, "endhostent") == 0
- || strcmp (tp->string, "endnetent") == 0
- || strcmp (tp->string, "endprotoent") == 0
- || strcmp (tp->string, "endservent") == 0
- || strcmp (tp->string, "time") == 0
- || strcmp (tp->string, "times") == 0
- || strcmp (tp->string, "wait") == 0
- || strcmp (tp->string, "wantarray") == 0)
+ else if (streq (tp->string, "wantarray")
+ || streq (tp->string, "fork")
+ || streq (tp->string, "getlogin")
+ || streq (tp->string, "getppid")
+ || streq (tp->string, "getpwent")
+ || streq (tp->string, "getgrent")
+ || streq (tp->string, "gethostent")
+ || streq (tp->string, "getnetent")
+ || streq (tp->string, "getprotoent")
+ || streq (tp->string, "getservent")
+ || streq (tp->string, "setpwent")
+ || streq (tp->string, "setgrent")
+ || streq (tp->string, "endpwent")
+ || streq (tp->string, "endgrent")
+ || streq (tp->string, "endhostent")
+ || streq (tp->string, "endnetent")
+ || streq (tp->string, "endprotoent")
+ || streq (tp->string, "endservent")
+ || streq (tp->string, "time")
+ || streq (tp->string, "times")
+ || streq (tp->string, "wait")
+ || streq (tp->string, "wantarray"))
{
/* A Perl built-in function that does not accept arguments. */
xp->last_token_type = token_type_variable;
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
+#include <string.h>
#define SB_NO_APPENDF
#include <error.h>
if (c != ':')
goto invalid_json;
- if (strcmp (s1, "version") == 0)
+ if (streq (s1, "version"))
{
/* Parse an integer. */
if (parse_integer () != pr_parsed)
sb_free (&buffer);
goto invalid_rsj;
}
- if (strcmp (sb_xcontents_c (&buffer), "1") != 0)
+ if (!streq (sb_xcontents_c (&buffer), "1"))
{
sb_free (&buffer);
goto invalid_rsj_version;
}
sb_free (&buffer);
}
- else if (strcmp (s1, "strings") == 0)
+ else if (streq (s1, "strings"))
{
/* Parse an array. */
c = phase2_getc ();
if (c != ':')
goto invalid_json;
- if (strcmp (s2, "hash") == 0)
+ if (streq (s2, "hash"))
{
/* Parse an integer. */
if (parse_integer () != pr_parsed)
}
sb_free (&buffer);
}
- else if (strcmp (s2, "name") == 0)
+ else if (streq (s2, "name"))
{
/* Parse a string. */
enum parse_result r = parse_string ();
mixed_string_contents_free1 (
mixed_string_buffer_result (&stringbuf));
}
- else if (strcmp (s2, "sourcebytes") == 0)
+ else if (streq (s2, "sourcebytes"))
{
/* Parse an array. */
c = phase2_getc ();
}
}
}
- else if (strcmp (s2, "value") == 0)
+ else if (streq (s2, "value"))
{
/* Parse a string. */
enum parse_result r = parse_string ();
mixed_string_contents_free1 (
mixed_string_buffer_cloned_result (inner.token));
- if (strcmp (function_name, "env") == 0)
+ if (streq (function_name, "env"))
{
/* The 'env' command just introduces more assignments.
Ignore it. */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#define SB_NO_APPENDF
#include <error.h>
phase3_get (&token2);
if (token2.type == token_type_symbol
- && strcmp (token2.string, ",") == 0)
+ && streq (token2.string, ","))
{
token_ty token3;
phase3_get (&token3);
switch (token.type)
{
case token_type_symbol:
- state = (strcmp (token.string, "NLS") == 0 ? 1 :
- strcmp (token.string, "?") == 0 && state == 1 ? 2 :
- strcmp (token.string, "at:") == 0 && state == 1 ? 3 :
- strcmp (token.string, "plural:") == 0 && state == 4 ? 5 :
+ state = (streq (token.string, "NLS") ? 1 :
+ streq (token.string, "?") && state == 1 ? 2 :
+ streq (token.string, "at:") && state == 1 ? 3 :
+ streq (token.string, "plural:") && state == 4 ? 5 :
0);
free_token (&token);
break;
plural_mp =
remember_a_message (mlp, NULL, token.string, false,
token2.type == token_type_symbol
- && strcmp (token.string, "plural:") == 0,
+ && streq (token.string, "plural:"),
null_context_region (), &pos,
NULL, token.comment, false);
break;
}
const char *contents = sb_xcontents_c (&buffer);
- if (strcmp (contents, "return") == 0)
+ if (streq (contents, "return"))
{
sb_free (&buffer);
tp->type = last_token_type = token_type_return;
token_ty token2;
x_vala_lex (&token2);
if (token2.type == token_type_symbol
- && strcmp (token2.string, ".") == 0)
+ && streq (token2.string, "."))
{
token_ty token3;
x_vala_lex (&token3);
if (token3.type == token_type_symbol
- && (strcmp (token3.string, "printf") == 0
- || strcmp (token3.string, "vprintf") == 0))
+ && (streq (token3.string, "printf")
+ || streq (token3.string, "vprintf")))
{
/* Mark the messages found in the region as c-format
a posteriori. */
best_msgctxt = ctxt;
else
{
- if (strcmp (ctxt, best_msgctxt) != 0)
+ if (!streq (ctxt, best_msgctxt))
if_error (IF_SEVERITY_WARNING,
best_cp->msgid_plural_pos.file_name,
best_cp->msgid_plural_pos.line_number,
if (mp != NULL && mp->comment_dot != NULL)
{
for (size_t k = 0; k < mp->comment_dot->nitems; k++)
- if (strcmp (xcomment, mp->comment_dot->item[k]) == 0)
+ if (streq (xcomment, mp->comment_dot->item[k]))
{
found = true;
break;
#include "xg-message.h"
#include <stdio.h>
+#include <string.h>
#include "c-strstr.h"
#include "if-error.h"
{
bool repeated = true;
for (size_t i = 0; i < added; i++)
- if (strcmp (mp->comment_dot->item[nitems_before - added + i],
- mp->comment_dot->item[nitems_before + i]) != 0)
+ if (!streq (mp->comment_dot->item[nitems_before - added + i],
+ mp->comment_dot->item[nitems_before + i]))
{
repeated = false;
break;
size_t i;
for (i = 0; i < NSYNTAXCHECKS; i++)
{
- if (strcmp (optarg, syntax_check_name[i]) == 0)
+ if (streq (optarg, syntax_check_name[i]))
{
default_syntax_check[i] = yes;
break;
size_t i;
for (i = 0; i < NSYNTAXCHECKS; i++)
{
- if (strcmp (optarg, syntax_check_name[i]) == 0)
+ if (streq (optarg, syntax_check_name[i]))
{
default_syntax_check[i] = no;
break;
break;
case CHAR_MAX + 19: /* --sentence-end */
- if (strcmp (optarg, "single-space") == 0)
+ if (streq (optarg, "single-space"))
sentence_end_required_spaces = 1;
- else if (strcmp (optarg, "double-space") == 0)
+ else if (streq (optarg, "double-space"))
sentence_end_required_spaces = 2;
else
error (EXIT_FAILURE, 0, _("sentence end type '%s' unknown"), optarg);
error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
"--kde", "--boost");
- if (join_existing && strcmp (default_domain, "-") == 0)
+ if (join_existing && streq (default_domain, "-"))
error (EXIT_FAILURE, 0,
_("--join-existing cannot be used when output is written to stdout"));
the special name "-" we write to stdout. */
if (output_file)
{
- if (IS_RELATIVE_FILE_NAME (output_file) && strcmp (output_file, "-") != 0)
+ if (IS_RELATIVE_FILE_NAME (output_file) && !streq (output_file, "-"))
/* Please do NOT add a .po suffix! */
file_name =
xconcatenated_filename (defaulted_output_dir, output_file, NULL);
else
file_name = xstrdup (output_file);
}
- else if (strcmp (default_domain, "-") == 0)
+ else if (streq (default_domain, "-"))
file_name = "-";
else
file_name =
string_list_ty *file_list;
if (files_from != NULL)
{
- if (strcmp (files_from, "-") != 0)
+ if (!streq (files_from, "-"))
string_list_append (&files_for_vc_mtime, files_from);
file_list = read_names_from_file (files_from);
}
/* If language is not determined from the file name
extension, check ITS locating rules. */
if (language_from_extension == NULL
- && strcmp (filename, "-") != 0)
+ && !streq (filename, "-"))
{
const char *its_basename =
locating_rule_list_locate (its_locating_rules,
switch (type)
{
case format_c:
- if (backend == NULL || strcmp (backend, "C") == 0
- || strcmp (backend, "C++") == 0)
+ if (backend == NULL || streq (backend, "C")
+ || streq (backend, "C++"))
{
flag_context_list_table_insert (&flag_table_c, XFORMAT_PRIMARY,
name_start, name_end,
argnum, value, pass);
}
- if (backend == NULL || strcmp (backend, "C++") == 0)
+ if (backend == NULL || streq (backend, "C++"))
{
flag_context_list_table_insert (&flag_table_cxx_qt, XFORMAT_PRIMARY,
name_start, name_end,
name_start, name_end,
argnum, value, pass);
}
- if (backend == NULL || strcmp (backend, "ObjectiveC") == 0)
+ if (backend == NULL || streq (backend, "ObjectiveC"))
{
flag_context_list_table_insert (&flag_table_objc, XFORMAT_PRIMARY,
name_start, name_end,
argnum, value, pass);
}
- if (backend == NULL || strcmp (backend, "D") == 0)
+ if (backend == NULL || streq (backend, "D"))
{
flag_context_list_table_insert (&flag_table_d, XFORMAT_PRIMARY,
name_start, name_end,
argnum, value, pass);
}
- if (backend == NULL || strcmp (backend, "Vala") == 0)
+ if (backend == NULL || streq (backend, "Vala"))
{
flag_context_list_table_insert (&flag_table_vala, XFORMAT_PRIMARY,
name_start, name_end,
char *logical_file_name;
char *new_name;
- if (strcmp (fn, "-") == 0)
+ if (streq (fn, "-"))
{
new_name = xstrdup (_("standard input"));
logical_file_name = xstrdup (new_name);
/* Handle --qt. It's preferrable to handle this facility here rather
than through an option --language=C++/Qt because the latter would
conflict with the language "C++" regarding the file extensions. */
- if (recognize_format_qt && strcmp (tp->name, "C++") == 0)
+ if (recognize_format_qt && streq (tp->name, "C++"))
{
result.flag_table = &flag_table_cxx_qt;
result.formatstring_parser[XFORMAT_TERTIARY] = &formatstring_qt;
result.formatstring_parser[XFORMAT_FOURTH] = &formatstring_qt_plural;
}
/* Likewise for --kde. */
- if (recognize_format_kde && strcmp (tp->name, "C++") == 0)
+ if (recognize_format_kde && streq (tp->name, "C++"))
{
result.flag_table = &flag_table_cxx_kde;
result.formatstring_parser[XFORMAT_TERTIARY] = &formatstring_kde;
result.formatstring_parser[XFORMAT_FOURTH] = &formatstring_kde_kuit;
}
/* Likewise for --boost. */
- if (recognize_format_boost && strcmp (tp->name, "C++") == 0)
+ if (recognize_format_boost && streq (tp->name, "C++"))
{
result.flag_table = &flag_table_cxx_boost;
result.formatstring_parser[XFORMAT_TERTIARY] = &formatstring_boost;
};
for (table_ty *tp = table; tp < ENDOF(table); ++tp)
- if (strcmp (extension, tp->extension) == 0)
+ if (streq (extension, tp->extension))
return tp->language;
return NULL;
}