[pango/log-attr-tweaks: 21/23] Cosmetics




commit fad50680025e2297860f21863585425985ebe33f
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 21 22:44:18 2021 -0400

    Cosmetics

 pango/break.c       | 120 ++++++++++++++++++++++++++++------------------------
 pango/pango-break.h |   8 ++--
 2 files changed, 68 insertions(+), 60 deletions(-)
---
diff --git a/pango/break.c b/pango/break.c
index 01257f87..a08716a7 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -139,29 +139,12 @@ typedef enum
   WordNumbers
 } WordType;
 
-
-/**
- * pango_default_break:
- * @text: text to break. Must be valid UTF-8
- * @length: length of text in bytes (may be -1 if @text is nul-terminated)
- * @analysis: (nullable): a `PangoAnalysis` structure for the @text
- * @attrs: logical attributes to fill in
- * @attrs_len: size of the array passed as @attrs
- *
- * This is the default break algorithm.
- *
- * It applies Unicode rules without language-specific
- * tailoring, therefore the @analyis argument is unused
- * and can be %NULL.
- *
- * See [func@Pango.tailor_break] for language-specific breaks.
- */
-void
-pango_default_break (const gchar   *text,
-                    gint           length,
-                    PangoAnalysis *analysis G_GNUC_UNUSED,
-                    PangoLogAttr  *attrs,
-                    int            attrs_len G_GNUC_UNUSED)
+static void
+default_break (const char    *text,
+               int            length,
+               PangoAnalysis *analysis G_GNUC_UNUSED,
+               PangoLogAttr  *attrs,
+               int            attrs_len G_GNUC_UNUSED)
 {
   /* The rationale for all this is in section 5.15 of the Unicode 3.0 book,
    * the line breaking stuff is also in TR14 on unicode.org
@@ -1639,7 +1622,7 @@ break_script (const char          *item_text,
 }
 
 /* }}} */
-/* {{{ Attribute-based tailoring */
+/* {{{ Attribute-based customization */
 
 static gboolean
 break_attrs (const char   *text,
@@ -1707,11 +1690,11 @@ break_attrs (const char   *text,
 
 static gboolean
 tailor_break (const char    *text,
-             int            length,
-             PangoAnalysis *analysis,
+              int            length,
+              PangoAnalysis *analysis,
               int            item_offset,
-             PangoLogAttr  *attrs,
-             int            attrs_len)
+              PangoLogAttr  *attrs,
+              int            attrs_len)
 {
   gboolean res;
 
@@ -2100,6 +2083,32 @@ check_space_invariants (const char          *text,
 /* }}} */
 /* {{{ Public API */
 
+/**
+ * pango_default_break:
+ * @text: text to break. Must be valid UTF-8
+ * @length: length of text in bytes (may be -1 if @text is nul-terminated)
+ * @analysis: (nullable): a `PangoAnalysis` structure for the @text
+ * @attrs: logical attributes to fill in
+ * @attrs_len: size of the array passed as @attrs
+ *
+ * This is the default break algorithm.
+ *
+ * It applies Unicode rules without language-specific
+ * tailoring, therefore the @analyis argument is unused
+ * and can be %NULL.
+ *
+ * See [func@Pango.tailor_break] for language-specific breaks.
+ */
+void
+pango_default_break (const char    *text,
+                     int            length,
+                     PangoAnalysis *analysis G_GNUC_UNUSED,
+                     PangoLogAttr  *attrs,
+                     int            attrs_len G_GNUC_UNUSED)
+{
+  default_break (text, length, analysis, attrs, attrs_len);
+}
+
 /**
  * pango_break:
  * @text: the text to process. Must be valid UTF-8
@@ -2118,7 +2127,7 @@ check_space_invariants (const char          *text,
  *   [func@Pango.tailor_break]
  */
 void
-pango_break (const gchar   *text,
+pango_break (const char    *text,
              gint           length,
              PangoAnalysis *analysis,
              PangoLogAttr  *attrs,
@@ -2127,7 +2136,7 @@ pango_break (const gchar   *text,
   g_return_if_fail (analysis != NULL);
   g_return_if_fail (attrs != NULL);
 
-  pango_default_break (text, length, analysis, attrs, attrs_len);
+  default_break (text, length, analysis, attrs, attrs_len);
   tailor_break (text, length, analysis, -1, attrs, attrs_len);
 }
 
@@ -2138,12 +2147,11 @@ pango_break (const gchar   *text,
  * @analysis: `PangoAnalysis` for @text
  * @offset: Byte offset of @text from the beginning of the
  *   paragraph, or -1 to ignore attributes from @analysis
- * @log_attrs: (array length=log_attrs_len): array with one `PangoLogAttr`
+ * @attrs: (array length=attrs_len): array with one `PangoLogAttr`
  *   per character in @text, plus one extra, to be filled in
- * @log_attrs_len: length of @log_attrs array
+ * @attrs_len: length of @attrs array
  *
- * Apply language-specific tailoring to the breaks
- * in @log_attrs.
+ * Apply language-specific tailoring to the breaks in @attrs.
  *
  * The line breaks are assumed to have been produced
  * by [func@Pango.default_break].
@@ -2158,13 +2166,13 @@ pango_tailor_break (const char    *text,
                     int            length,
                     PangoAnalysis *analysis,
                     int            offset,
-                    PangoLogAttr  *log_attrs,
-                    int            log_attrs_len)
+                    PangoLogAttr  *attrs,
+                    int            attrs_len)
 {
-  PangoLogAttr *start = log_attrs;
+  PangoLogAttr *start = attrs;
   PangoLogAttr attr_before = *start;
 
-  if (tailor_break (text, length, analysis, offset, log_attrs, log_attrs_len))
+  if (tailor_break (text, length, analysis, offset, attrs, attrs_len))
     {
       /* if tailored, we enforce some of the attrs from before
        * tailoring at the boundary
@@ -2184,13 +2192,13 @@ pango_tailor_break (const char    *text,
  * @length: length in bytes of @text
  * @level: embedding level, or -1 if unknown
  * @language: language tag
- * @log_attrs: (array length=attrs_len): array with one `PangoLogAttr`
+ * @attrs: (array length=attrs_len): array with one `PangoLogAttr`
  *   per character in @text, plus one extra, to be filled in
- * @attrs_len: length of @log_attrs array
+ * @attrs_len: length of @attrs array
  *
  * Computes a `PangoLogAttr` for each character in @text.
  *
- * The @log_attrs array must have one `PangoLogAttr` for
+ * The @attrs array must have one `PangoLogAttr` for
  * each position in @text; if @text contains N characters,
  * it has N+1 positions, including the last position at the
  * end of the text. @text should be an entire paragraph;
@@ -2203,7 +2211,7 @@ pango_get_log_attrs (const char    *text,
                      int            length,
                      int            level,
                      PangoLanguage *language,
-                     PangoLogAttr  *log_attrs,
+                     PangoLogAttr  *attrs,
                      int            attrs_len)
 {
   int chars_broken;
@@ -2211,12 +2219,12 @@ pango_get_log_attrs (const char    *text,
   PangoScriptIter iter;
 
   g_return_if_fail (length == 0 || text != NULL);
-  g_return_if_fail (log_attrs != NULL);
+  g_return_if_fail (attrs != NULL);
 
   analysis.level = level;
   analysis.language = language;
 
-  pango_default_break (text, length, &analysis, log_attrs, attrs_len);
+  pango_default_break (text, length, &analysis, attrs, attrs_len);
 
   chars_broken = 0;
 
@@ -2236,7 +2244,7 @@ pango_get_log_attrs (const char    *text,
                           run_end - run_start,
                           &analysis,
                           -1,
-                          log_attrs + chars_broken,
+                          attrs + chars_broken,
                           chars_in_range + 1);
 
       chars_broken += chars_in_range;
@@ -2252,12 +2260,12 @@ pango_get_log_attrs (const char    *text,
 
 /**
  * pango_validate_log_attrs:
- * @text: text to which @log_attrs belong
+ * @text: text to which @attrs belong
  * @length: length of @text
- * @log_attrs: `PangoLogAttr` array to validate
- * @attrs_len: length of @log_attrs
+ * @attrs: `PangoLogAttr` array to validate
+ * @attrs_len: length of @lattrs
  *
- * Apply sanity checks to @log_attrs.
+ * Apply sanity checks to @attrs.
  *
  * This function checks some conditions that Pango
  * relies on. It is not guaranteed to be an exhaustive
@@ -2278,14 +2286,14 @@ pango_get_log_attrs (const char    *text,
  * - Words don't end in the middle of graphemes
  * - Sentences don't end in the middle of words
  *
- * Returns: %TRUE if @log_attrs are valid
+ * Returns: %TRUE if @attrs are valid
  *
  * Since: 1.50
  */
 gboolean
 pango_validate_log_attrs (const char          *text,
                           int                  length,
-                          const PangoLogAttr  *log_attrs,
+                          const PangoLogAttr  *attrs,
                           int                  attrs_len,
                           GError             **error)
 {
@@ -2300,19 +2308,19 @@ pango_validate_log_attrs (const char          *text,
       return FALSE;
     }
 
-  if (!check_line_invariants (text, length, log_attrs, attrs_len, error))
+  if (!check_line_invariants (text, length, attrs, attrs_len, error))
     return FALSE;
 
-  if (!check_grapheme_invariants (text, length, log_attrs, attrs_len, error))
+  if (!check_grapheme_invariants (text, length, attrs, attrs_len, error))
     return FALSE;
 
-  if (!check_word_invariants (text, length, log_attrs, attrs_len, error))
+  if (!check_word_invariants (text, length, attrs, attrs_len, error))
     return FALSE;
 
-  if (!check_sentence_invariants (text, length, log_attrs, attrs_len, error))
+  if (!check_sentence_invariants (text, length, attrs, attrs_len, error))
     return FALSE;
 
-  if (!check_space_invariants (text, length, log_attrs, attrs_len, error))
+  if (!check_space_invariants (text, length, attrs, attrs_len, error))
     return FALSE;
 
   return TRUE;
diff --git a/pango/pango-break.h b/pango/pango-break.h
index af049315..15db125b 100644
--- a/pango/pango-break.h
+++ b/pango/pango-break.h
@@ -105,7 +105,7 @@ void                    pango_get_log_attrs     (const char    *text,
                                                  int            length,
                                                  int            level,
                                                  PangoLanguage *language,
-                                                 PangoLogAttr  *log_attrs,
+                                                 PangoLogAttr  *attrs,
                                                  int            attrs_len);
 
 PANGO_AVAILABLE_IN_ALL
@@ -120,8 +120,8 @@ void                    pango_tailor_break      (const char    *text,
                                                  int            length,
                                                  PangoAnalysis *analysis,
                                                  int            offset,
-                                                 PangoLogAttr  *log_attrs,
-                                                 int            log_attrs_len);
+                                                 PangoLogAttr  *attrs,
+                                                 int            attrs_len);
 
 #define PANGO_VALIDATE_ERROR (pango_validate_error_quark ())
 
@@ -141,7 +141,7 @@ GQuark                 pango_validate_error_quark (void);
 PANGO_AVAILABLE_IN_1_50
 gboolean               pango_validate_log_attrs (const char          *text,
                                                  int                  length,
-                                                 const PangoLogAttr  *log_attrs,
+                                                 const PangoLogAttr  *attrs,
                                                  int                  attrs_len,
                                                  GError             **error);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]