From: Bruno Haible Date: Thu, 2 Jan 2025 13:12:12 +0000 (+0100) Subject: Update after gnulib changed. X-Git-Tag: v0.24~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a152589376f3784ceaaee55ab630c7f4c20277ae;p=thirdparty%2Fgettext.git Update after gnulib changed. * gettext-runtime/src/envsubst.c (subst_from_stdin): Use sd_ function prefix instead of string_desc_ function prefix. * gettext-tools/src/its.c (set_doc_encoding_utf8, _its_is_valid_simple_gen_xml, is_valid_xhtml_element, is_valid_html_element, is_no_end_html_element): Likewise. * gettext-tools/src/msgl-ascii.c (is_ascii_string_desc): Likewise. * gettext-tools/src/msgl-iconv.c (convert_string_desc_directly): Likewise. * gettext-tools/src/read-desktop.c (desktop_lex): Likewise. * gettext-tools/src/x-awk.c (phase2_getc, phase3_get): Likewise. * gettext-tools/src/x-c.c (phase5_get): Likewise. * gettext-tools/src/x-perl.c (get_here_document, extract_quotelike_pass1, extract_quotelike_pass1_utf8, extract_quotelike, extract_triple_quotelike, extract_quotelike_pass3, extract_variable, interpolate_keywords, x_perl_prelex): Likewise. * gettext-tools/src/x-php.c (phase4_get): Likewise. * gettext-tools/src/x-rst.c (parse_integer): Likewise. * gettext-tools/src/x-ycp.c (phase2_getc, phase5_get): Likewise. * gettext-tools/src/xg-encoding.c (string_desc_from_current_source_encoding): Likewise. --- diff --git a/gettext-runtime/src/envsubst.c b/gettext-runtime/src/envsubst.c index e5d1f070d..2d6e30d4a 100644 --- a/gettext-runtime/src/envsubst.c +++ b/gettext-runtime/src/envsubst.c @@ -1,5 +1,5 @@ /* Substitution of environment variables in shell format strings. - Copyright (C) 2003-2024 Free Software Foundation, Inc. + Copyright (C) 2003-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software: you can redistribute it and/or modify @@ -549,7 +549,7 @@ subst_from_stdin () putchar ('$'); if (opening_brace) putchar ('{'); - string_desc_fwrite (stdout, sb_contents (&buffer)); + sd_fwrite (stdout, sb_contents (&buffer)); if (closing_brace) putchar ('}'); } diff --git a/gettext-tools/src/its.c b/gettext-tools/src/its.c index 3f28f8851..8990aee5a 100644 --- a/gettext-tools/src/its.c +++ b/gettext-tools/src/its.c @@ -1,5 +1,5 @@ /* Internationalization Tag Set (ITS) handling - Copyright (C) 2015-2024 Free Software Foundation, Inc. + Copyright (C) 2015-2025 Free Software Foundation, Inc. This file was written by Daiki Ueno , 2015. @@ -2242,9 +2242,9 @@ set_doc_encoding_utf8 (xmlDoc *doc) doc->encoding = BAD_CAST xstrdup ("UTF-8"); return true; } - string_desc_t enc = string_desc_from_c ((char *) doc->encoding); - if (string_desc_c_casecmp (enc, string_desc_from_c ("UTF-8")) == 0 - || string_desc_c_casecmp (enc, string_desc_from_c ("UTF8")) == 0) + string_desc_t enc = sd_from_c ((char *) doc->encoding); + if (sd_c_casecmp (enc, sd_from_c ("UTF-8")) == 0 + || sd_c_casecmp (enc, sd_from_c ("UTF8")) == 0) return true; /* The document's encoding is not UTF-8. Conversion would be expensive. */ return false; @@ -2340,9 +2340,8 @@ _its_is_valid_simple_gen_xml (const char *contents, if (add_to_node != NULL && !slash_before_tag) { string_desc_t name = - string_desc_new_addr (name_end - name_start, - (char *) name_start); - char *name_c = xstring_desc_c (name); + sd_new_addr (name_end - name_start, (char *) name_start); + char *name_c = xsd_c (name); if (ignore_case) { /* Convert the name to lower case. */ @@ -2433,13 +2432,13 @@ _its_is_valid_simple_gen_xml (const char *contents, if (add_to_node != NULL) { string_desc_t attr_name = - string_desc_new_addr (attr_name_end - attr_name_start, - (char *) attr_name_start); + sd_new_addr (attr_name_end - attr_name_start, + (char *) attr_name_start); string_desc_t attr_value = - string_desc_new_addr (attr_value_end - attr_value_start, - (char *) attr_value_start); - char *attr_name_c = xstring_desc_c (attr_name); - char *attr_value_c = xstring_desc_c (attr_value); + sd_new_addr (attr_value_end - attr_value_start, + (char *) attr_value_start); + char *attr_name_c = xsd_c (attr_name); + char *attr_value_c = xsd_c (attr_value); xmlAttr *attr = xmlNewProp (current_node, BAD_CAST attr_name_c, BAD_CAST attr_value_c); @@ -2475,7 +2474,7 @@ _its_is_valid_simple_gen_xml (const char *contents, /* Seen a complete <...> element start/end. */ /* Verify that the tag is allowed. */ string_desc_t tag = - string_desc_new_addr (name_end - name_start, (char *) name_start); + sd_new_addr (name_end - name_start, (char *) name_start); if (!(valid_element == NULL || valid_element (tag))) return false; if (slash_after_tag || (no_end_element != NULL && no_end_element (tag))) @@ -2499,7 +2498,7 @@ _its_is_valid_simple_gen_xml (const char *contents, if (open_elements_count == 0) /* The end of an element without a corresponding start. */ return false; - if ((ignore_case ? string_desc_c_casecmp : string_desc_cmp) + if ((ignore_case ? sd_c_casecmp : sd_cmp) (open_elements[open_elements_count - 1], tag) != 0) return false; @@ -2666,7 +2665,7 @@ is_valid_xhtml_element (string_desc_t tag) /* Invariant: If tag occurs in the table, it is at an index >= lo, < hi. */ size_t i = (lo + hi) / 2; /* >= lo, < hi */ - int cmp = string_desc_cmp (tag, string_desc_from_c (allowed[i])); + int cmp = sd_cmp (tag, sd_from_c (allowed[i])); if (cmp == 0) return true; if (cmp < 0) @@ -2764,7 +2763,7 @@ is_valid_html_element (string_desc_t tag) /* Invariant: If tag occurs in the table, it is at an index >= lo, < hi. */ size_t i = (lo + hi) / 2; /* >= lo, < hi */ - int cmp = string_desc_cmp (tag, string_desc_from_c (allowed[i])); + int cmp = sd_cmp (tag, sd_from_c (allowed[i])); if (cmp == 0) return true; if (cmp < 0) @@ -2781,8 +2780,8 @@ is_no_end_html_element (string_desc_t tag) /* Specification: https://html.spec.whatwg.org/ Search for "Tag omission in text/html: No end tag." */ - return string_desc_cmp (tag, string_desc_from_c ("br")) == 0 - || string_desc_cmp (tag, string_desc_from_c ("hr")) == 0; + return sd_cmp (tag, sd_from_c ("br")) == 0 + || sd_cmp (tag, sd_from_c ("hr")) == 0; } /* Returns true if the argument is a piece of simple well-formed HTML diff --git a/gettext-tools/src/msgl-ascii.c b/gettext-tools/src/msgl-ascii.c index 07bcd74ad..9b21d047c 100644 --- a/gettext-tools/src/msgl-ascii.c +++ b/gettext-tools/src/msgl-ascii.c @@ -1,5 +1,5 @@ /* Message list test for ASCII character set. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify @@ -41,10 +41,10 @@ is_ascii_string (const char *string) bool is_ascii_string_desc (string_desc_t string) { - size_t len = string_desc_length (string); + size_t len = sd_length (string); size_t i; for (i = 0; i < len; i++) - if (!c_isascii ((unsigned char) string_desc_char_at (string, i))) + if (!c_isascii ((unsigned char) sd_char_at (string, i))) return false; return true; } diff --git a/gettext-tools/src/msgl-iconv.c b/gettext-tools/src/msgl-iconv.c index 4223c9935..178940465 100644 --- a/gettext-tools/src/msgl-iconv.c +++ b/gettext-tools/src/msgl-iconv.c @@ -1,5 +1,5 @@ /* Message list charset and locale charset handling. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify @@ -102,13 +102,13 @@ convert_string_desc_directly (iconv_t cd, string_desc_t string, char *result = NULL; size_t resultlen = 0; - if (xmem_cd_iconv (string_desc_data (string), string_desc_length (string), + if (xmem_cd_iconv (sd_data (string), sd_length (string), cd, &result, &resultlen) == 0) - return string_desc_new_addr (resultlen, result); + return sd_new_addr (resultlen, result); conversion_error (context, textmode_xerror_handler); /* NOTREACHED */ - return string_desc_new_empty (); + return sd_new_empty (); } static char * diff --git a/gettext-tools/src/read-desktop.c b/gettext-tools/src/read-desktop.c index 8bfa01aed..477fae157 100644 --- a/gettext-tools/src/read-desktop.c +++ b/gettext-tools/src/read-desktop.c @@ -1,5 +1,5 @@ /* Reading Desktop Entry files. - Copyright (C) 1995-2024 Free Software Foundation, Inc. + Copyright (C) 1995-2025 Free Software Foundation, Inc. This file was written by Daiki Ueno . This program is free software: you can redistribute it and/or modify @@ -333,7 +333,7 @@ desktop_lex (token_ty *tp) /* Finish the key part and start the locale part. */ APPEND (0); found_locale = true; - locale_start = string_desc_length (sb_contents (&buffer)); + locale_start = sd_length (sb_contents (&buffer)); for (;;) { @@ -406,7 +406,7 @@ desktop_lex (token_ty *tp) } size_t before_value_lineno = pos.line_number; - value_start = string_desc_length (sb_contents (&buffer)); + value_start = sd_length (sb_contents (&buffer)); for (;;) { c = phase2_getc (); diff --git a/gettext-tools/src/x-awk.c b/gettext-tools/src/x-awk.c index 58aa34c4b..23790951b 100644 --- a/gettext-tools/src/x-awk.c +++ b/gettext-tools/src/x-awk.c @@ -1,5 +1,5 @@ /* xgettext awk backend. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. This file was written by Bruno Haible , 2002. @@ -186,7 +186,7 @@ phase2_getc () if (c == '\n' || c == EOF) break; /* We skip all leading white space, but not EOLs. */ - if (!(string_desc_length (sb_contents (&buffer)) == 0 + if (!(sd_length (sb_contents (&buffer)) == 0 && (c == ' ' || c == '\t'))) sb_xappend1 (&buffer, c); } @@ -464,8 +464,8 @@ phase3_get (token_ty *tp) default: { string_desc_t contents = sb_contents (&buffer); - if (string_desc_length (contents) == 1 - && string_desc_char_at (contents, 0) == '_' + if (sd_length (contents) == 1 + && sd_char_at (contents, 0) == '_' && c == '"') { sb_free (&buffer); diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c index ae065e913..68030f51a 100644 --- a/gettext-tools/src/x-c.c +++ b/gettext-tools/src/x-c.c @@ -1,5 +1,5 @@ /* xgettext C/C++/ObjectiveC backend. - Copyright (C) 1995-2024 Free Software Foundation, Inc. + Copyright (C) 1995-2025 Free Software Foundation, Inc. This file was written by Peter Miller @@ -1345,8 +1345,8 @@ phase5_get (token_ty *tp) case '"': { string_desc_t contents = sb_contents (&buffer); - const char *buf = string_desc_data (contents); - size_t buflen = string_desc_length (contents); + const char *buf = sd_data (contents); + size_t buflen = sd_length (contents); /* Recognize C11 / C++11 string literals. See (for C) ISO 9899:2011 section 6.4.5 @@ -1464,8 +1464,8 @@ phase5_get (token_ty *tp) /* Update the state. */ string_desc_t raw_contents = sb_contents (&buffer); - const char *raw_buf = string_desc_data (raw_contents); - size_t raw_buflen = string_desc_length (raw_contents); + const char *raw_buf = sd_data (raw_contents); + size_t raw_buflen = sd_length (raw_contents); if (c == (state < raw_buflen ? raw_buf[state] : '"')) { if (state < raw_buflen) @@ -1650,11 +1650,10 @@ phase5_get (token_ty *tp) can be part of a number token. It's called a "digit separator". See ISO C 23 § 6.4.4.1 and § 6.4.4.2. */ string_desc_t contents = sb_contents (&buffer); - if (string_desc_length (contents) > 0) + if (sd_length (contents) > 0) { char prev = - string_desc_char_at (contents, - string_desc_length (contents) - 1); + sd_char_at (contents, sd_length (contents) - 1); if ((prev >= '0' && prev <= '9') || (prev >= 'A' && prev <= 'F') || (prev >= 'a' && prev <= 'f')) diff --git a/gettext-tools/src/x-perl.c b/gettext-tools/src/x-perl.c index 4fab5a218..60c25efd6 100644 --- a/gettext-tools/src/x-perl.c +++ b/gettext-tools/src/x-perl.c @@ -1,5 +1,5 @@ /* xgettext Perl backend. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. This file was written by Guido Flohr , 2002-2010. @@ -507,7 +507,7 @@ get_here_document (struct perl_extractor *xp, const char *delimiter) my_linebuf[read_bytes - 1] = '\n'; /* Append this line to the accumulator. */ - sb_xappend_desc (&buffer, string_desc_new_addr (read_bytes, my_linebuf)); + sb_xappend_desc (&buffer, sd_new_addr (read_bytes, my_linebuf)); } /* Done accumulating the here document. */ @@ -782,7 +782,7 @@ extract_quotelike_pass1 (struct perl_extractor *xp, int delim) { string_desc_t inner = extract_quotelike_pass1 (xp, delim); sb_xappend_desc (&buffer, inner); - string_desc_free (inner); + sd_free (inner); } else if (c == '\\') { @@ -820,8 +820,8 @@ extract_quotelike_pass1_utf8 (struct perl_extractor *xp, int delim) string_desc_from_current_source_encoding (string, lc_string, logical_file_name, xp->line_number); - if (string_desc_data (utf8_string) != string_desc_data (string)) - string_desc_free (string); + if (sd_data (utf8_string) != sd_data (string)) + sd_free (string); return utf8_string; } @@ -913,14 +913,14 @@ static void extract_quotelike (struct perl_extractor *xp, token_ty *tp, int delim) { string_desc_t string = extract_quotelike_pass1_utf8 (xp, delim); - size_t len = string_desc_length (string); + size_t len = sd_length (string); tp->type = token_type_string; /* Take the string without the delimiters at the start and at the end. */ if (!(len >= 2)) abort (); - tp->string = string_desc_c (string_desc_substring (string, 1, len - 1)); - string_desc_free (string); + tp->string = sd_c (sd_substring (string, 1, len - 1)); + sd_free (string); tp->comment = add_reference (savable_comment); } @@ -939,7 +939,7 @@ extract_triple_quotelike (struct perl_extractor *xp, token_ty *tp, int delim, string = extract_quotelike_pass1_utf8 (xp, delim); if (interpolate) interpolate_keywords (xp, string, xp->line_number); - string_desc_free (string); + sd_free (string); if (delim == '(' || delim == '<' || delim == '{' || delim == '[') { @@ -956,7 +956,7 @@ extract_triple_quotelike (struct perl_extractor *xp, token_ty *tp, int delim, string = extract_quotelike_pass1_utf8 (xp, delim); if (interpolate) interpolate_keywords (xp, string, xp->line_number); - string_desc_free (string); + sd_free (string); } /* Perform pass 3 of quotelike extraction (interpolation). @@ -1089,8 +1089,7 @@ extract_quotelike_pass3 (struct perl_extractor *xp, token_ty *tp) int length = u8_uctomb ((unsigned char *) tmpbuf, oct_number, 2); if (length > 0) - sb_xappend_desc (&buffer, - string_desc_new_addr (length, tmpbuf)); + sb_xappend_desc (&buffer, sd_new_addr (length, tmpbuf)); } continue; case 'x': @@ -1139,8 +1138,7 @@ extract_quotelike_pass3 (struct perl_extractor *xp, token_ty *tp) int length = u8_uctomb ((unsigned char *) tmpbuf, hex_number, 6); if (length > 0) - sb_xappend_desc (&buffer, - string_desc_new_addr (length, tmpbuf)); + sb_xappend_desc (&buffer, sd_new_addr (length, tmpbuf)); } continue; case 'c': @@ -1178,7 +1176,7 @@ extract_quotelike_pass3 (struct perl_extractor *xp, token_ty *tp) u8_uctomb ((unsigned char *) tmpbuf, unicode, 6); if (length > 0) sb_xappend_desc (&buffer, - string_desc_new_addr (length, tmpbuf)); + sd_new_addr (length, tmpbuf)); } free (name); @@ -1378,12 +1376,12 @@ extract_variable (struct perl_extractor *xp, token_ty *tp, int first) /* Hash references are treated in a special way, when looking for our keywords. */ string_desc_t contents = sb_contents (&buffer); - if (string_desc_char_at (contents, 0) == '$') + if (sd_char_at (contents, 0) == '$') { - if (string_desc_length (contents) == 1) + if (sd_length (contents) == 1) maybe_hash_value = true; - else if (string_desc_length (contents) == 2 - && string_desc_char_at (contents, 1) == '$') + else if (sd_length (contents) == 2 + && sd_char_at (contents, 1) == '$') { if (!(c == '{' || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') @@ -1756,7 +1754,7 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, state = initial; region = null_context_region (); - length = string_desc_length (string); + length = sd_length (string); index = 0; token.type = token_type_string; @@ -1773,7 +1771,7 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, { void *keyword_value; - c = string_desc_char_at (string, index++); + c = sd_char_at (string, index++); if (state == initial) buffer.length = 0; @@ -1792,7 +1790,7 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, sb_free (&buffer); return; } - c = string_desc_char_at (string, index++); + c = sd_char_at (string, index++); break; case '$': sb_xappend1 (&buffer, '$'); @@ -1849,8 +1847,8 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, { string_desc_t contents = sb_contents (&buffer); if (hash_find_entry (&keywords, - string_desc_data (contents), - string_desc_length (contents), + sd_data (contents), + sd_length (contents), &keyword_value) == 0) { @@ -1858,8 +1856,8 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, flag_context_list_iterator ( flag_context_list_table_lookup ( flag_context_list_table, - string_desc_data (contents), - string_desc_length (contents))); + sd_data (contents), + sd_length (contents))); region = inheriting_region (null_context_region (), flag_context_list_iterator_advance ( @@ -1878,10 +1876,10 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, { string_desc_t contents = sb_contents (&buffer); if (!maybe_hash_deref) - string_desc_set_char_at (contents, 0, '%'); + sd_set_char_at (contents, 0, '%'); if (hash_find_entry (&keywords, - string_desc_data (contents), - string_desc_length (contents), + sd_data (contents), + sd_length (contents), &keyword_value) == 0) { @@ -1889,8 +1887,8 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, flag_context_list_iterator ( flag_context_list_table_lookup ( flag_context_list_table, - string_desc_data (contents), - string_desc_length (contents))); + sd_data (contents), + sd_length (contents))); region = inheriting_region (null_context_region (), flag_context_list_iterator_advance ( @@ -1962,7 +1960,7 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, } else { - c = string_desc_char_at (string, index++); + c = sd_char_at (string, index++); if (c == '\"') { sb_xappend1 (&buffer, c); @@ -1994,7 +1992,7 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, } else { - c = string_desc_char_at (string, index++); + c = sd_char_at (string, index++); if (c == '\'') { sb_xappend1 (&buffer, c); @@ -2091,7 +2089,7 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, } else { - c = string_desc_char_at (string, index++); + c = sd_char_at (string, index++); if (c == '\"') { sb_xappend1 (&buffer, c); @@ -2122,7 +2120,7 @@ interpolate_keywords (struct perl_extractor *xp, string_desc_t string, } else { - c = string_desc_char_at (string, index++); + c = sd_char_at (string, index++); if (c == '\'') { sb_xappend1 (&buffer, c); @@ -2479,7 +2477,7 @@ x_perl_prelex (struct perl_extractor *xp, token_ty *tp) extract_quotelike (xp, tp, delim); sb_free (&buffer); if (delim != '\'') - interpolate_keywords (xp, string_desc_from_c (tp->string), + interpolate_keywords (xp, sd_from_c (tp->string), xp->line_number); free (tp->string); drop_reference (tp->comment); @@ -2535,7 +2533,7 @@ x_perl_prelex (struct perl_extractor *xp, token_ty *tp) case 'x': tp->type = token_type_string; tp->sub_type = string_type_qq; - interpolate_keywords (xp, string_desc_from_c (tp->string), + interpolate_keywords (xp, sd_from_c (tp->string), xp->line_number); break; case 'r': @@ -2575,14 +2573,14 @@ x_perl_prelex (struct perl_extractor *xp, token_ty *tp) case '"': extract_quotelike (xp, tp, c); tp->sub_type = string_type_qq; - interpolate_keywords (xp, string_desc_from_c (tp->string), + interpolate_keywords (xp, sd_from_c (tp->string), xp->line_number); return; case '`': extract_quotelike (xp, tp, c); tp->sub_type = string_type_qq; - interpolate_keywords (xp, string_desc_from_c (tp->string), + interpolate_keywords (xp, sd_from_c (tp->string), xp->line_number); return; @@ -2680,7 +2678,7 @@ x_perl_prelex (struct perl_extractor *xp, token_ty *tp) tp->type = token_type_string; tp->sub_type = string_type_qq; tp->line_number = xp->line_number + 1; - interpolate_keywords (xp, string_desc_from_c (tp->string), + interpolate_keywords (xp, sd_from_c (tp->string), tp->line_number); return; } @@ -2714,7 +2712,7 @@ x_perl_prelex (struct perl_extractor *xp, token_ty *tp) tp->sub_type = string_type_qq; tp->comment = add_reference (savable_comment); tp->line_number = xp->line_number + 1; - interpolate_keywords (xp, string_desc_from_c (tp->string), + interpolate_keywords (xp, sd_from_c (tp->string), tp->line_number); return; } @@ -2756,7 +2754,7 @@ x_perl_prelex (struct perl_extractor *xp, token_ty *tp) if (prefer_regexp_over_division (tp->last_type)) { extract_quotelike (xp, tp, c); - interpolate_keywords (xp, string_desc_from_c (tp->string), + interpolate_keywords (xp, sd_from_c (tp->string), xp->line_number); free (tp->string); drop_reference (tp->comment); diff --git a/gettext-tools/src/x-php.c b/gettext-tools/src/x-php.c index 231480f0d..6a6797f86 100644 --- a/gettext-tools/src/x-php.c +++ b/gettext-tools/src/x-php.c @@ -1,5 +1,5 @@ /* xgettext PHP backend. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This file was written by Bruno Haible , 2002. @@ -1320,14 +1320,14 @@ phase4_get (struct php_extractor *xp, token_ty *tp) bool heredoc = true; string_desc_t label = sb_contents (&buffer); size_t label_start = 0; - size_t label_end = string_desc_length (label); + size_t label_end = sd_length (label); if (label_end >= 2 - && ((string_desc_char_at (label, label_start) == '\'' - && string_desc_char_at (label, label_end - 1) == '\'') - || (string_desc_char_at (label, label_start) == '"' - && string_desc_char_at (label, label_end - 1) == '"'))) + && ((sd_char_at (label, label_start) == '\'' + && sd_char_at (label, label_end - 1) == '\'') + || (sd_char_at (label, label_start) == '"' + && sd_char_at (label, label_end - 1) == '"'))) { - heredoc = (string_desc_char_at (label, label_start) == '"'); + heredoc = (sd_char_at (label, label_start) == '"'); label_start++; label_end--; } @@ -1368,7 +1368,7 @@ phase4_get (struct php_extractor *xp, token_ty *tp) } else if (in_label_pos >= 0 && in_label_pos < label_end - label_start - && c == string_desc_char_at (label, label_start + in_label_pos)) + && c == sd_char_at (label, label_start + in_label_pos)) { in_label_pos++; } diff --git a/gettext-tools/src/x-rst.c b/gettext-tools/src/x-rst.c index b93be2f32..10b958060 100644 --- a/gettext-tools/src/x-rst.c +++ b/gettext-tools/src/x-rst.c @@ -1,5 +1,5 @@ /* xgettext RST/RSJ backend. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This file was written by Bruno Haible , 2001. @@ -357,7 +357,7 @@ parse_integer () c = phase1_getc (); } phase1_ungetc (c); - return (string_desc_length (sb_contents (&buffer)) == 0 ? pr_none : pr_parsed); + return (sd_length (sb_contents (&buffer)) == 0 ? pr_none : pr_parsed); } static struct mixed_string_buffer stringbuf; diff --git a/gettext-tools/src/x-ycp.c b/gettext-tools/src/x-ycp.c index 37edd49a2..25a1336e5 100644 --- a/gettext-tools/src/x-ycp.c +++ b/gettext-tools/src/x-ycp.c @@ -1,5 +1,5 @@ /* xgettext YCP backend. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This file was written by Bruno Haible , 2001. @@ -162,7 +162,7 @@ phase2_getc () if (c == '\n' || c == EOF) break; /* We skip all leading white space, but not EOLs. */ - if (!(string_desc_length (sb_contents (&buffer)) == 0 + if (!(sd_length (sb_contents (&buffer)) == 0 && (c == ' ' || c == '\t'))) sb_xappend1 (&buffer, c); } @@ -200,7 +200,7 @@ phase2_getc () break; } /* We skip all leading white space, but not EOLs. */ - if (string_desc_length (sb_contents (&buffer)) == 0 + if (sd_length (sb_contents (&buffer)) == 0 && (c == ' ' || c == '\t')) continue; sb_xappend1 (&buffer, c); @@ -257,7 +257,7 @@ phase2_getc () if (c == '\n' || c == EOF) break; /* We skip all leading white space, but not EOLs. */ - if (!(string_desc_length (sb_contents (&buffer)) == 0 + if (!(sd_length (sb_contents (&buffer)) == 0 && (c == ' ' || c == '\t'))) sb_xappend1 (&buffer, c); } @@ -474,8 +474,8 @@ phase5_get (token_ty *tp) default: { string_desc_t contents = sb_contents (&buffer); - if (string_desc_length (contents) == 1 - && string_desc_char_at (contents, 0) == '_' + if (sd_length (contents) == 1 + && sd_char_at (contents, 0) == '_' && c == '(') { sb_free (&buffer); diff --git a/gettext-tools/src/xg-encoding.c b/gettext-tools/src/xg-encoding.c index 714a4922a..148d8b382 100644 --- a/gettext-tools/src/xg-encoding.c +++ b/gettext-tools/src/xg-encoding.c @@ -1,5 +1,5 @@ /* Keeping track of the encoding of strings to be extracted. - Copyright (C) 2001-2023 Free Software Foundation, Inc. + Copyright (C) 2001-2025 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 @@ -220,8 +220,7 @@ string_desc_from_current_source_encoding (string_desc_t string, } else if (xgettext_current_source_encoding == po_charset_utf8) { - if (u8_check ((const uint8_t *) string_desc_data (string), - string_desc_length (string)) + if (u8_check ((const uint8_t *) sd_data (string), sd_length (string)) != NULL) { multiline_error (xstrdup (""),