]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hardlink: define more function as inline
authorKarel Zak <kzak@redhat.com>
Tue, 29 Apr 2025 10:50:48 +0000 (12:50 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 29 Apr 2025 10:53:55 +0000 (12:53 +0200)
The functions are called many times.

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/hardlink.c

index d32d0c6da0e5f44b53d3214a533806edeab7c4e9..85d25ca2228d57eefbe2cdbe63e36ed92cae5611 100644 (file)
@@ -295,7 +295,7 @@ static void register_regex(struct hdl_regex **pregs, const char *regex)
  * Checks whether any of the regular expressions in the list matches the
  * string.
  */
-static int match_any_regex(struct hdl_regex *pregs, const char *what)
+static inline int match_any_regex(struct hdl_regex *pregs, const char *what)
 {
        for (; pregs != NULL; pregs = pregs->next) {
                if (regexec(&pregs->re, what, 0, NULL, 0) == 0)
@@ -649,7 +649,7 @@ static int file_xattrs_equal(const struct file *a, const struct file *b)
  * Check whether the two files are considered equal attributes and can be
  * linked. This function does not compare content od the files!
  */
-static int file_may_link_to(const struct file *a, const struct file *b)
+static inline int file_may_link_to(const struct file *a, const struct file *b)
 {
        return (a->st.st_size == b->st.st_size &&
                a->links != NULL && b->links != NULL &&
@@ -673,7 +673,7 @@ static int file_may_link_to(const struct file *a, const struct file *b)
  * as the master when linking (the master is the file that all equal files
  * will be replaced with).
  */
-static int file_compare(const struct file *a, const struct file *b)
+static inline int file_compare(const struct file *a, const struct file *b)
 {
        int res = 0;
        if (a->st.st_dev == b->st.st_dev && a->st.st_ino == b->st.st_ino)
@@ -815,7 +815,7 @@ static int file_link(struct file *a, struct file *b, int reflink)
        return TRUE;
 }
 
-static int has_fpath(struct file *node, const char *path)
+static inline int has_fpath(struct file *node, const char *path)
 {
        struct link *l;