]> Savannah Git Hosting - gnulib.git/commitdiff
git-merge-changelog, gen-uni-tables: Use str_startswith.
authorBruno Haible <bruno@clisp.org>
Fri, 3 Jan 2025 09:12:08 +0000 (10:12 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 3 Jan 2025 09:12:08 +0000 (10:12 +0100)
* lib/git-merge-changelog.c (main): Use str_startswith.
* lib/gen-uni-tables.c (output_predicate, is_property_composite,
is_nonspacing): Likewise.
* modules/git-merge-changelog (Depends-on): Add str_startswith.
* modules/gen-uni-tables (Depends-on): Likewise.

ChangeLog
lib/gen-uni-tables.c
lib/git-merge-changelog.c
modules/gen-uni-tables
modules/git-merge-changelog

index b57ea5cae1a75d2f831ec9ec6e7b8f8f411f6abf..1355aa2361658751c15dcb81bdc877c80cfce00c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-01-03  Bruno Haible  <bruno@clisp.org>
+
+       git-merge-changelog, gen-uni-tables: Use str_startswith.
+       * lib/git-merge-changelog.c (main): Use str_startswith.
+       * lib/gen-uni-tables.c (output_predicate, is_property_composite,
+       is_nonspacing): Likewise.
+       * modules/git-merge-changelog (Depends-on): Add str_startswith.
+       * modules/gen-uni-tables (Depends-on): Likewise.
+
 2025-01-03  Bruno Haible  <bruno@clisp.org>
 
        str_endswith: Add tests.
index ff515854e02208fde7ccb7c8b2cfb84cf6f96f04..c676660b073ff6d0a7ec86c617123b69b200ae30 100644 (file)
@@ -776,7 +776,7 @@ output_predicate (const char *filename, bool (*predicate) (unsigned int), const
   fprintf (stream, "\n");
   output_library_license (stream,
                           strcmp (filename, "unictype/categ_M.h") == 0
-                          || strncmp (filename, "unictype/ctype_", 15) == 0
+                          || str_startswith (filename, "unictype/ctype_")
                           || strcmp (filename, "uniwidth/width2.h") == 0);
   fprintf (stream, "\n");
 
@@ -3883,7 +3883,7 @@ is_property_composite (unsigned int ch)
           if (decomp[0] == ' ')
             decomp++;
         }
-      return strchr (decomp, ' ') != NULL && strncmp (decomp, "0020 ", 5) != 0;
+      return strchr (decomp, ' ') != NULL && str_startswith (decomp, "0020 ");
     }
   return false;
 }
@@ -6827,7 +6827,7 @@ is_nonspacing (unsigned int ch)
               || is_category_Cc (ch)
               || (is_category_Cf (ch)
                   && !is_property_prepended_concatenation_mark (ch))
-              || strncmp (unicode_attributes[ch].name, "ZERO WIDTH ", 11) == 0
+              || str_startswith (unicode_attributes[ch].name, "ZERO WIDTH ")
               || (ch >= 0x1160 && ch <= 0x11A7) || (ch >= 0xD7B0 && ch <= 0xD7C6) /* jungseong */
               || (ch >= 0x11A8 && ch <= 0x11FF) || (ch >= 0xD7CB && ch <= 0xD7FB) /* jongseong */
          )   );
index 74b6a5b63a54695e3e0b4131e3f749e1fbbfca72..190dafc140dc1a94c869c56faeec78dbde28de96 100644 (file)
@@ -1163,9 +1163,9 @@ There is NO WARRANTY, to the extent permitted by law.\n\
               printf ("GIT_REFLOG_ACTION=|%s|\n", var);
               #endif
               if (var != NULL
-                  && ((strncmp (var, "pull", 4) == 0
+                  && ((str_startswith (var, "pull")
                        && c_strstr (var, " --rebase") == NULL)
-                      || strncmp (var, "merge origin", 12) == 0))
+                      || str_startswith (var, "merge origin")))
                 downstream = true;
               else
                 {
index c61d34194c56966906c5a1003510793872add455..561a39690b8050a7476980c589370afbfca22ad2 100644 (file)
@@ -12,6 +12,7 @@ memcmp
 bool
 strdup
 strstr-simple
+str_startswith
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 1ef3e1102fdb4dcc345a7a6d1718297df6650923..9ff56dcc86ea43fe19c5bc2c44509ecb65aeedbe 100644 (file)
@@ -22,6 +22,7 @@ xalloc
 xmalloca
 fstrcmp
 minmax
+str_startswith
 c-strstr
 fwriteerror
 memchr