* m4/more-warnings.m4 (gt_MORE_WARNINGS): Update comment.
* gettext-tools/src/cldr-plural-exp.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(cldr_plural_rule_list_print): Use countof instead of SIZEOF.
* gettext-tools/src/format-kde-kuit.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(is_reference): Use countof instead of SIZEOF.
* gettext-tools/src/its.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(_its_is_valid_simple_gen_xml, is_valid_xhtml_element, is_valid_html_element):
Use countof instead of SIZEOF.
* gettext-tools/src/msginit.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(catalogname_for_locale, plural_forms, fill_header): Use countof instead of
SIZEOF.
* gettext-tools/src/msgl-check.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(check_header_entry): Use countof instead of SIZEOF.
* gettext-tools/src/msgl-header.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(msgdomain_list_set_header_field): Use countof instead of SIZEOF.
* gettext-tools/src/open-catalog.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(try_open_catalog_file): Use countof instead of SIZEOF.
* gettext-tools/src/po-charset.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(po_charset_canonicalize, po_is_charset_weird, po_is_charset_weird_cjk): Use
countof instead of SIZEOF.
* gettext-tools/src/write-mo.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(write_table): Use countof instead of SIZEOF.
* gettext-tools/src/x-awk.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase3_unget): Use countof instead of SIZEOF.
* gettext-tools/src/x-c.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase2_ungetc, phase3_ungetc, phase5_unget, phase6_unget,
x_c_unlex): Use countof instead of SIZEOF.
* gettext-tools/src/x-csharp.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase2_ungetc, phase3_ungetc, phase5_ungetc, phase6_unget,
phase7_unget): Use countof instead of SIZEOF.
* gettext-tools/src/x-java.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase2_ungetc, phase3_ungetc, phase5_unget, phase6_unget): Use
countof instead of SIZEOF.
* gettext-tools/src/x-javascript.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase2_ungetc, phase5_scan_xml_markup, phase5_unget): Use
countof instead of SIZEOF.
* gettext-tools/src/x-lua.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase3_unget, phase4_unget): Use countof instead of SIZEOF.
* gettext-tools/src/x-modula2.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase2_ungetc, phase3_unget, phase4_unget): Use countof instead of SIZEOF.
* gettext-tools/src/x-php.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase2_ungetc, phase3_ungetc, phase4_unget): Use countof instead
of SIZEOF.
* gettext-tools/src/x-python.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase2_ungetc, phase5_unget): Use countof instead of SIZEOF.
* gettext-tools/src/x-scheme.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, read_object): Use countof instead of SIZEOF.
* gettext-tools/src/x-sh.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase2_ungetc): Use countof instead of SIZEOF.
* gettext-tools/src/x-smalltalk.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase2_unget, phase3_unget, phase4_unget): Use countof instead of SIZEOF.
* gettext-tools/src/x-tcl.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase2_ungetc): Use countof instead of SIZEOF.
* gettext-tools/src/x-vala.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase1_ungetc, phase3_unget, phase4_unget): Use countof instead of SIZEOF.
* gettext-tools/src/x-ycp.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(phase2_ungetc, phase5_unget, phase8_unget): Use countof instead of SIZEOF.
* gettext-tools/src/xg-check.c: Include <stdcountof.h>
(SIZEOF): Remove macro.
(string_has_url): Use countof instead of SIZEOF.
* gettext-tools/src/xgettext.c (SIZEOF): Remove macro.
#include <config.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
print_condition_greater
};
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
void
cldr_plural_rule_list_print (struct cldr_plural_rule_list_ty *rules, FILE *fp)
{
break;
struct cldr_plural_condition_ty *condition = rules->items[i]->condition;
- for (size_t j = 0; j < SIZEOF (print_condition_functions); j++)
+ for (size_t j = 0; j < countof (print_condition_functions); j++)
if (print_condition_functions[j] (condition, fp))
return;
}
#include <assert.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdlib.h>
#include "format.h"
#define _(str) gettext (str)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* KUIT (KDE User Interface Text) is an XML-like markup which augments
translatable strings with semantic information:
/* EntityRef */
{
bool isNameStartChar = false;
- for (int i = 0; i < SIZEOF (name_chars1); i++)
+ for (int i = 0; i < countof (name_chars1); i++)
if (name_chars1[i].start <= uc && uc <= name_chars1[i].end)
{
isNameStartChar = true;
str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
bool isNameChar = false;
- for (int i = 0; i < SIZEOF (name_chars1); i++)
+ for (int i = 0; i < countof (name_chars1); i++)
if (name_chars1[i].start <= uc && uc <= name_chars1[i].end)
{
isNameChar = true;
break;
}
if (!isNameChar)
- for (int i = 0; i < SIZEOF (name_chars2); i++)
+ for (int i = 0; i < countof (name_chars2); i++)
if (name_chars2[i].start <= uc && uc <= name_chars2[i].end)
{
isNameChar = true;
#include <errno.h>
#include <setjmp.h>
#include <stdarg.h>
+#include <stdcountof.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define _(str) gettext (str)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The Internationalization Tag Set (ITS) 2.0 standard is available at:
https://www.w3.org/TR/its20/
/* Stack of open elements. */
string_desc_t open_elements[100];
size_t open_elements_count = 0;
- const size_t open_elements_max = SIZEOF (open_elements);
+ const size_t open_elements_max = countof (open_elements);
const char *p = contents;
const char *curr_text_segment_start = p;
if (set_doc_encoding_utf8 (add_to_node->doc))
{
uint8_t buf[6];
- int nbytes = u8_uctomb (buf, ucs, SIZEOF (buf));
+ int nbytes = u8_uctomb (buf, ucs, countof (buf));
if (nbytes <= 0)
abort ();
xmlNodeSetContentLen (text_node, BAD_CAST buf, nbytes);
};
/* Use binary search. */
size_t lo = 0;
- size_t hi = SIZEOF (allowed);
+ size_t hi = countof (allowed);
while (lo < hi)
{
/* Invariant:
};
/* Use binary search. */
size_t lo = 0;
- size_t hi = SIZEOF (allowed);
+ size_t hi = countof (allowed);
while (lo < hi)
{
/* Invariant:
#include <fcntl.h>
#include <limits.h>
#include <locale.h>
+#include <stdcountof.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
# define F_OK 0
#endif
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
extern const char * _nl_expand_alias (const char *name);
/* Locale name. */
}
/* If the territory is the language's principal territory, drop it. */
- for (size_t i = 0; i < SIZEOF (locales_with_principal_territory); i++)
+ for (size_t i = 0; i < countof (locales_with_principal_territory); i++)
if (streq (locale, locales_with_principal_territory[i]))
{
const char *language_end = strchr (locale, '_');
dirs[0] = "common";
dirs[1] = "supplemental";
dirs[2] = "plurals.xml";
- for (size_t i = 0; i < SIZEOF (dirs); i++)
+ for (size_t i = 0; i < countof (dirs); i++)
{
char *dir = xconcatenated_filename (last_dir, dirs[i], NULL);
free (last_dir);
if (fresh)
{
fields = fresh_fields;
- nfields = SIZEOF (fresh_fields);
+ nfields = countof (fresh_fields);
field_last_translator = FRESH_FIELDS_LAST_TRANSLATOR;
}
else
{
fields = update_fields;
- nfields = SIZEOF (update_fields);
+ nfields = countof (update_fields);
field_last_translator = UPDATE_FIELDS_LAST_TRANSLATOR;
}
(time (&now), (localtime (&now))->tm_year + 1900));
}
- subst_string_list (header_mp->comment, SIZEOF (subst), subst);
+ subst_string_list (header_mp->comment, countof (subst), subst);
}
/* Finally remove the fuzzy attribute. */
#include "msgl-check.h"
#include <limits.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(str) gettext (str)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* Evaluates the plural formula for min <= n <= max
and returns the estimated number of times the value j was assumed. */
"text/plain; charset=CHARSET", "ENCODING",
""
};
- const size_t nfields = SIZEOF (required_fields);
+ const size_t nfields = countof (required_fields);
/* FIXME: We could check if a required header field is missing and
report it as error. However, it's could be too rigorous and
break backward compatibility. */
/* Specification. */
#include "msgl-header.h"
+#include <stdcountof.h>
#include <string.h>
#include "xalloc.h"
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
void
header_set_charset (message_ty *header_mp, const char *charsetstr,
/* Search the field in known_fields[]. */
int field_index = -1;
- for (size_t k = 0; k < SIZEOF (known_fields); k++)
+ for (size_t k = 0; k < countof (known_fields); k++)
if (streq (known_fields[k].name, field))
{
field_index = k;
/* Test whether h starts with a field name whose index is
> field_index. */
size_t k;
- for (k = field_index + 1; k < SIZEOF (known_fields); k++)
+ for (k = field_index + 1; k < countof (known_fields); k++)
if (strncmp (h, known_fields[k].name, known_fields[k].len)
== 0)
break;
- if (k < SIZEOF (known_fields))
+ if (k < countof (known_fields))
break;
h = strchr (h, '\n');
if (h == NULL)
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(str) gettext (str)
-/* This macro is used to determine the number of elements in an array. */
-#define SIZEOF(a) (sizeof(a)/sizeof(a[0]))
-
static FILE *
try_open_catalog_file (const char *input_name, char **real_file_name_p)
{
specified, the current directory is used. */
const char *dir;
for (int j = 0; (dir = dir_list_nth (j)) != NULL; ++j)
- for (size_t k = 0; k < SIZEOF (extension); ++k)
+ for (size_t k = 0; k < countof (extension); ++k)
{
char *file_name =
xconcatenated_filename (dir, input_name, extension[k]);
{
/* The name is not relative. Try the various extensions, but ignore the
directory search list. */
- for (size_t k = 0; k < SIZEOF (extension); ++k)
+ for (size_t k = 0; k < countof (extension); ++k)
{
char *file_name =
xconcatenated_filename ("", input_name, extension[k]);
/* Specification. */
#include "po-charset.h"
+#include <stdcountof.h>
#include <string.h>
#include "c-strcase.h"
#define _(str) gettext (str)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
static const char ascii[] = "ASCII";
/* The canonicalized encoding name for ASCII. */
utf8
};
- for (size_t i = 0; i < SIZEOF (standard_charsets); i++)
+ for (size_t i = 0; i < countof (standard_charsets); i++)
if (c_strcasecmp (charset, standard_charsets[i]) == 0)
return standard_charsets[i < 3 ? 0 : i < 27 ? ((i - 3) & ~1) + 3 : i];
return NULL;
"JOHAB"
};
- for (size_t i = 0; i < SIZEOF (weird_charsets); i++)
+ for (size_t i = 0; i < countof (weird_charsets); i++)
if (streq (canon_charset, weird_charsets[i]))
return true;
return false;
"JOHAB" /* 0x{00..7F}, 0x{84..F9}{31..FE} */
};
- for (size_t i = 0; i < SIZEOF (weird_cjk_charsets); i++)
+ for (size_t i = 0; i < countof (weird_cjk_charsets); i++)
if (streq (canon_charset, weird_cjk_charsets[i]))
return true;
return false;
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
# endif /* GNU CC2 */
#endif /* roundup */
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* True if no conversion to UTF-8 is desired. */
bool no_convert_to_utf8;
for (size_t ss = 0; ss < n_sysdep_strings; ss++)
{
- for (size_t u = 0; u < SIZEOF (useful_instantiation_rules); u++)
+ for (size_t u = 0; u < countof (useful_instantiation_rules); u++)
{
const struct sysdep_instantiation_rule *instrule =
&useful_instantiation_rules[u];
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The awk syntax is defined in the gawk manual page and documentation.
See also gawk/awkgram.y. */
{
if (tp->type != token_type_eof)
{
- if (phase3_pushback_length == SIZEOF (phase3_pushback))
+ if (phase3_pushback_length == countof (phase3_pushback))
abort ();
phase3_pushback[phase3_pushback_length++] = *tp;
}
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The ANSI C standard defines several phases of translation:
FALLTHROUGH;
default:
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
break;
{
if (c != EOF)
{
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
}
{
if (c != EOF)
{
- if (phase3_pushback_length == SIZEOF (phase3_pushback))
+ if (phase3_pushback_length == countof (phase3_pushback))
abort ();
phase3_pushback[phase3_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (phase5_pushback_length == SIZEOF (phase5_pushback))
+ if (phase5_pushback_length == countof (phase5_pushback))
abort ();
phase5_pushback[phase5_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase6_pushback_length == SIZEOF (phase6_pushback))
+ if (phase6_pushback_length == countof (phase6_pushback))
abort ();
phase6_pushback[phase6_pushback_length++] = *tp;
}
{
if (tp->type != xgettext_token_type_eof)
{
- if (phase9_pushback_length == SIZEOF (phase9_pushback))
+ if (phase9_pushback_length == countof (phase9_pushback))
abort ();
phase9_pushback[phase9_pushback_length++] = *tp;
}
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The C# syntax is defined in ECMA-334, second edition.
Strings with embedded expressions are defined in
{
if (c == '\n')
--line_number;
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
}
{
if (c != UEOF)
{
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
}
{
if (c == UNL)
--logical_line_number;
- if (phase3_pushback_length == SIZEOF (phase3_pushback))
+ if (phase3_pushback_length == countof (phase3_pushback))
abort ();
phase3_pushback[phase3_pushback_length++] = c;
}
{
if (c != UEOF)
{
- if (phase5_pushback_length == SIZEOF (phase5_pushback))
+ if (phase5_pushback_length == countof (phase5_pushback))
abort ();
phase5_pushback[phase5_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (phase6_pushback_length == SIZEOF (phase6_pushback))
+ if (phase6_pushback_length == countof (phase6_pushback))
abort ();
phase6_pushback[phase6_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase7_pushback_length == SIZEOF (phase7_pushback))
+ if (phase7_pushback_length == countof (phase7_pushback))
abort ();
phase7_pushback[phase7_pushback_length++] = *tp;
}
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The Java syntax is defined in the
Java Language Specification
phase1_pushback[phase1_pushback_length - 1]++;
else
{
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = MULTIPLE_U (1);
}
}
else
{
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
}
{
if (c != P2_EOF)
{
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
}
{
if (c == '\n')
--line_number;
- if (phase3_pushback_length == SIZEOF (phase3_pushback))
+ if (phase3_pushback_length == countof (phase3_pushback))
abort ();
phase3_pushback[phase3_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (phase5_pushback_length == SIZEOF (phase5_pushback))
+ if (phase5_pushback_length == countof (phase5_pushback))
abort ();
phase5_pushback[phase5_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase6_pushback_length == SIZEOF (phase6_pushback))
+ if (phase6_pushback_length == countof (phase6_pushback))
abort ();
phase6_pushback[phase6_pushback_length++] = *tp;
}
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The JavaScript aka ECMA-Script syntax is defined in ECMA-262
specification:
<https://www.ecma-international.org/publications/standards/Ecma-262.htm>
if (c == '\n')
--line_number;
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
}
{
if (c != UEOF)
{
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
}
{ "?", "?" }
};
- for (int i = 0; i < SIZEOF (markers); i++)
+ for (int i = 0; i < countof (markers); i++)
{
const char *start = markers[i].start;
const char *end = markers[i].end;
/* Look for a start marker. */
for (j = 0; start[j] != '\0'; j++)
{
- assert (phase2_pushback_length + j < SIZEOF (phase2_pushback));
+ assert (phase2_pushback_length + j < countof (phase2_pushback));
int c = phase2_getc ();
if (c == UEOF)
goto eof;
{
for (j = 0; end[j] != '\0'; j++)
{
- assert (phase2_pushback_length + 1 < SIZEOF (phase2_pushback));
+ assert (phase2_pushback_length + 1 < countof (phase2_pushback));
int c = phase2_getc ();
if (c == UEOF)
goto eof;
{
if (tp->type != token_type_eof)
{
- if (phase5_pushback_length == SIZEOF (phase5_pushback))
+ if (phase5_pushback_length == countof (phase5_pushback))
abort ();
phase5_pushback[phase5_pushback_length++] = *tp;
}
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The Lua syntax is defined in the Lua manual sections 3.1 and 9,
which can be found at
https://www.lua.org/manual/5.2/manual.html#3.1
if (c == '\n')
--line_number;
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (phase3_pushback_length == SIZEOF (phase3_pushback))
+ if (phase3_pushback_length == countof (phase3_pushback))
abort ();
phase3_pushback[phase3_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase4_pushback_length == SIZEOF (phase4_pushback))
+ if (phase4_pushback_length == countof (phase4_pushback))
abort ();
phase4_pushback[phase4_pushback_length++] = *tp;
}
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The Modula-2 syntax is defined in the book
"The Programming Language Modula-2" by Niklaus Wirth
{
if (c != EOF)
{
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (phase3_pushback_length == SIZEOF (phase3_pushback))
+ if (phase3_pushback_length == countof (phase3_pushback))
abort ();
phase3_pushback[phase3_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase4_pushback_length == SIZEOF (phase4_pushback))
+ if (phase4_pushback_length == countof (phase4_pushback))
abort ();
phase4_pushback[phase4_pushback_length++] = *tp;
}
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The PHP syntax is defined in phpdoc/manual/langref.html.
See also php-8.1.0/Zend/zend_language_scanner.l
if (c == '\n')
--(xp->line_number);
- if (xp->phase1_pushback_length == SIZEOF (xp->phase1_pushback))
+ if (xp->phase1_pushback_length == countof (xp->phase1_pushback))
abort ();
xp->phase1_pushback[xp->phase1_pushback_length++] = c;
}
{
if (c != EOF)
{
- if (xp->phase2_pushback_length == SIZEOF (xp->phase2_pushback))
+ if (xp->phase2_pushback_length == countof (xp->phase2_pushback))
abort ();
xp->phase2_pushback[xp->phase2_pushback_length++] = c;
}
{
if (c != EOF)
{
- if (xp->phase3_pushback_length == SIZEOF (xp->phase3_pushback))
+ if (xp->phase3_pushback_length == countof (xp->phase3_pushback))
abort ();
xp->phase3_pushback[xp->phase3_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (xp->phase4_pushback_length == SIZEOF (xp->phase4_pushback))
+ if (xp->phase4_pushback_length == countof (xp->phase4_pushback))
abort ();
xp->phase4_pushback[xp->phase4_pushback_length++] = *tp;
}
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#undef max /* clean up after MSVC's <stdlib.h> */
#define max(a,b) ((a) > (b) ? (a) : (b))
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The Python syntax is defined in the Python Reference Manual
/usr/share/doc/packages/python/html/ref/index.html.
if (c == '\n')
--line_number;
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
}
{
if (c != UEOF)
{
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (phase5_pushback_length == SIZEOF (phase5_pushback))
+ if (phase5_pushback_length == countof (phase5_pushback))
abort ();
phase5_pushback[phase5_pushback_length++] = *tp;
}
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The Scheme syntax is described in R5RS and following standards:
- R5RS: https://conservatory.scheme.org/schemers/Documents/Standards/R5RS/HTML/
if (c == '\n')
--line_number;
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
}
"curly-infix",
"curly-infix-and-bracket-lists"
};
- int num_directives = SIZEOF (directives);
+ int num_directives = countof (directives);
enum { max_directive_len = 29 };
bool seen_directive = false;
for (int d = 0; d < num_directives; d++)
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The sh syntax is defined in POSIX:2001, see
http://www.opengroup.org/onlinepubs/007904975/utilities/xcu_chap02.html
FALLTHROUGH;
default:
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
break;
FALLTHROUGH;
default:
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
break;
#include "x-smalltalk.h"
#include <errno.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The relevant parts of the Smalltalk syntax are:
{
if (tp->type != token_type_eof)
{
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase3_pushback_length == SIZEOF (phase3_pushback))
+ if (phase3_pushback_length == countof (phase3_pushback))
abort ();
phase3_pushback[phase3_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase4_pushback_length == SIZEOF (phase4_pushback))
+ if (phase4_pushback_length == countof (phase4_pushback))
abort ();
phase4_pushback[phase4_pushback_length++] = *tp;
}
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The Tcl syntax is defined in the Tcl.n manual page, see
https://www.tcl-lang.org/man/tcl8.6/TclCmd/Tcl.htm .
FALLTHROUGH;
default:
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
break;
++brace_depth;
break;
}
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
}
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The Vala syntax is defined in the Vala Reference Manual
https://gnome.pages.gitlab.gnome.org/vala/manual/index.html.
See also vala/valascanner.vala.
if (c == '\n')
--line_number;
- if (phase1_pushback_length == SIZEOF (phase1_pushback))
+ if (phase1_pushback_length == countof (phase1_pushback))
abort ();
phase1_pushback[phase1_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (phase3_pushback_length == SIZEOF (phase3_pushback))
+ if (phase3_pushback_length == countof (phase3_pushback))
abort ();
phase3_pushback[phase3_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase4_pushback_length == SIZEOF (phase4_pushback))
+ if (phase4_pushback_length == countof (phase4_pushback))
abort ();
phase4_pushback[phase4_pushback_length++] = *tp;
}
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
+#include <stdcountof.h>
#include <stdio.h>
#include <stdlib.h>
#define _(s) gettext(s)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* The YCP syntax is defined in libycp/doc/syntax.html.
See also libycp/src/scanner.ll.
{
if (c != EOF)
{
- if (phase2_pushback_length == SIZEOF (phase2_pushback))
+ if (phase2_pushback_length == countof (phase2_pushback))
abort ();
phase2_pushback[phase2_pushback_length++] = c;
}
{
if (tp->type != token_type_eof)
{
- if (phase5_pushback_length == SIZEOF (phase5_pushback))
+ if (phase5_pushback_length == countof (phase5_pushback))
abort ();
phase5_pushback[phase5_pushback_length++] = *tp;
}
{
if (tp->type != token_type_eof)
{
- if (phase8_pushback_length == SIZEOF (phase8_pushback))
+ if (phase8_pushback_length == countof (phase8_pushback))
abort ();
phase8_pushback[phase8_pushback_length++] = *tp;
}
/* Specification. */
#include "xg-check.h"
+#include <stdcountof.h>
#include <stdlib.h>
#include <string.h>
#define _(str) gettext (str)
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
/* Function that implements a single syntax check.
MP is a message.
"irc://", "ircs://"
};
- for (size_t i = 0; i < SIZEOF (patterns); i++)
+ for (size_t i = 0; i < countof (patterns); i++)
{
const char *pattern = patterns[i];
/* msgid and msgid_plural are typically entirely ASCII. Therefore here
#include "x-appdata.h"
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-#define ENDOF(a) ((a) + SIZEOF(a))
+#define ENDOF(a) ((a) + countof (a))
/* If true, add all comments immediately preceding one of the keywords. */
# more-warnings.m4
-# serial 6 (gettext-1.1)
+# serial 7 (gettext-1.1)
dnl Copyright (C) 2023-2026 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl are worth eliminating; see below.
nw="$nw -Wshadow"
dnl Too many warnings. We often use signed types like 'int' or 'idx_t'
- dnl for counter variables, yet SIZEOF(array) is an unsigned value.
+ dnl for counter variables, yet countof(array) is an unsigned value.
nw="$nw -Wsign-compare"
dnl This warning is based on older ISO C standards. It warns, in particular,
dnl about function definitions that are valid in ISO C 23 (static and