]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
file-remote: Use streq.
authorBruno Haible <bruno@clisp.org>
Sat, 28 Feb 2026 20:45:08 +0000 (21:45 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 28 Feb 2026 20:45:08 +0000 (21:45 +0100)
* lib/file-remote.c (is_remote_fs_type_name, file_is_remote): Use streq
instead of strcmp.
* modules/file-remote (Depends-on): Add streq.

ChangeLog
lib/file-remote.c
modules/file-remote

index f3afcc4f3b83cddb211590bef7d4353308b484d4..008e8a2500cd401f310f0145265b1ab3c3a55853 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-02-28  Bruno Haible  <bruno@clisp.org>
+
+       file-remote: Use streq.
+       * lib/file-remote.c (is_remote_fs_type_name, file_is_remote): Use streq
+       instead of strcmp.
+       * modules/file-remote (Depends-on): Add streq.
+
 2026-02-28  Bruno Haible  <bruno@clisp.org>
 
        Straighten dependencies to streq or memeq.
index 49c83190c1d44bd88d6efd432b82191fe560dcc8..21fe63851a712b7a03084f5db2c6e4d83dece81c 100644 (file)
 int _GL_ATTRIBUTE_CONST
 is_remote_fs_type_name (const char *fs_type)
 {
-  return (   strcmp (fs_type, "acfs") == 0
-          || strcmp (fs_type, "afs") == 0
-          || strcmp (fs_type, "autofs") == 0
-          || strcmp (fs_type, "auristorfs") == 0
-          || strcmp (fs_type, "cachefs") == 0
-          || strcmp (fs_type, "ceph") == 0
-          || strcmp (fs_type, "cifs") == 0
-          || strcmp (fs_type, "coda") == 0
-          || strcmp (fs_type, "fhgfs") == 0
-          || strcmp (fs_type, "gfs") == 0
-          || strcmp (fs_type, "gfs2") == 0
-          || strcmp (fs_type, "gpfs") == 0
-          || strcmp (fs_type, "ibrix") == 0
-          || strcmp (fs_type, "lustre") == 0
-          || strcmp (fs_type, "ncpfs") == 0
-          || strcmp (fs_type, "netfs") == 0
-          || strcmp (fs_type, "nfs") == 0
-          || strcmp (fs_type, "nfs3") == 0
-          || strcmp (fs_type, "nfs4") == 0
-          || strcmp (fs_type, "ocfs2") == 0
-          || strcmp (fs_type, "panfs") == 0
-          || strcmp (fs_type, "smb") == 0
-          || strcmp (fs_type, "smb2") == 0
-          || strcmp (fs_type, "smb3") == 0
-          || strcmp (fs_type, "smbfs") == 0
-          || strcmp (fs_type, "snfs") == 0
-          || strcmp (fs_type, "stnfs") == 0
-          || strcmp (fs_type, "userlandfs") == 0
-          || strcmp (fs_type, "vxfs") == 0
-          || strcmp (fs_type, "websearchfs") == 0);
+  return (   streq (fs_type, "acfs")
+          || streq (fs_type, "afs")
+          || streq (fs_type, "autofs")
+          || streq (fs_type, "auristorfs")
+          || streq (fs_type, "cachefs")
+          || streq (fs_type, "ceph")
+          || streq (fs_type, "cifs")
+          || streq (fs_type, "coda")
+          || streq (fs_type, "fhgfs")
+          || streq (fs_type, "gfs")
+          || streq (fs_type, "gfs2")
+          || streq (fs_type, "gpfs")
+          || streq (fs_type, "ibrix")
+          || streq (fs_type, "lustre")
+          || streq (fs_type, "ncpfs")
+          || streq (fs_type, "netfs")
+          || streq (fs_type, "nfs")
+          || streq (fs_type, "nfs3")
+          || streq (fs_type, "nfs4")
+          || streq (fs_type, "ocfs2")
+          || streq (fs_type, "panfs")
+          || streq (fs_type, "smb")
+          || streq (fs_type, "smb2")
+          || streq (fs_type, "smb3")
+          || streq (fs_type, "smbfs")
+          || streq (fs_type, "snfs")
+          || streq (fs_type, "stnfs")
+          || streq (fs_type, "userlandfs")
+          || streq (fs_type, "vxfs")
+          || streq (fs_type, "websearchfs"));
 }
 
 #if defined _WIN32 || defined __CYGWIN__                    /* Windows */
@@ -227,15 +227,15 @@ file_is_remote (const char *file)
   if (statfs (file, &fs) < 0)
     return -1;
   return (fs.f_flags & MNT_LOCAL) == 0
-         && !(strcmp (fs.f_fstypename, "fdesc") == 0);
+         && !streq (fs.f_fstypename, "fdesc");
 #elif defined __FreeBSD__ || defined __DragonFly__ || defined __FreeBSD_kernel__
                                                      /* FreeBSD, GNU/kFreeBSD */
   struct statfs fs;
   if (statfs (file, &fs) < 0)
     return -1;
   return (fs.f_flags & MNT_LOCAL) == 0
-         && !(strcmp (fs.f_fstypename, "devfs") == 0
-              || strcmp (fs.f_fstypename, "fdescfs") == 0);
+         && !(streq (fs.f_fstypename, "devfs")
+              || streq (fs.f_fstypename, "fdescfs"));
 #elif defined __NetBSD__                                    /* NetBSD */
   struct statvfs fs;
   if (statvfs1 (file, &fs, ST_NOWAIT) < 0)
@@ -251,20 +251,20 @@ file_is_remote (const char *file)
   if (statvfs (file, &fs) < 0)
     return -1;
   /* See /etc/vfs.  */
-  return (strcmp (fs.f_basetype, "nfs") == 0
-          || strcmp (fs.f_basetype, "nfs3") == 0
-          || strcmp (fs.f_basetype, "nfs4") == 0
-          || strcmp (fs.f_basetype, "stnfs") == 0
-          || strcmp (fs.f_basetype, "cachefs") == 0);
+  return (streq (fs.f_basetype, "nfs")
+          || streq (fs.f_basetype, "nfs3")
+          || streq (fs.f_basetype, "nfs4")
+          || streq (fs.f_basetype, "stnfs")
+          || streq (fs.f_basetype, "cachefs"));
 #elif defined __sun                                         /* Solaris */
   struct statvfs fs;
   if (statvfs (file, &fs) < 0)
     return -1;
   /* See /etc/dfs/fstypes.  */
-  return (strcmp (fs.f_basetype, "nfs") == 0
-          || strcmp (fs.f_basetype, "smb") == 0
-          || strcmp (fs.f_basetype, "smbfs") == 0
-          || strcmp (fs.f_basetype, "autofs") == 0);
+  return (streq (fs.f_basetype, "nfs")
+          || streq (fs.f_basetype, "smb")
+          || streq (fs.f_basetype, "smbfs")
+          || streq (fs.f_basetype, "autofs"));
 #elif defined __CYGWIN__                                    /* Cygwin */
   /* The 'struct statfs' member 'f_type' does not have the
      necessary information.  We need to use the native Windows API.  */
@@ -286,10 +286,10 @@ file_is_remote (const char *file)
   struct fs_info fs;
   if (fs_stat_dev (device, &fs) != B_OK)
     return -1;
-  return (strcmp (fs.fsh_name, "userlandfs") == 0
-          || strcmp (fs.fsh_name, "nfs") == 0
-          || strcmp (fs.fsh_name, "netfs") == 0
-          || strcmp (fs.fsh_name, "websearchfs") == 0);
+  return (streq (fs.fsh_name, "userlandfs")
+          || streq (fs.fsh_name, "nfs")
+          || streq (fs.fsh_name, "netfs")
+          || streq (fs.fsh_name, "websearchfs"));
 #else                                                       /* Unknown OS */
 # if defined SLOW_AND_OVERKILL
   /* This makes many system calls, is therefore slow, and
index 6090103934a82ca3509ccc0e4d81822853b767ea..f6d384a4f22f4c6e11b630af167125a02560f489 100644 (file)
@@ -7,6 +7,7 @@ lib/file-remote.c
 
 Depends-on:
 cygpath
+streq
 
 configure.ac: