Skip to content

Commit f6ee3b3

Browse files
hadessjbkempf
authored andcommitted
Document strrcmp()
So we don't need to reverse-engineer what it does from reading the code. The documentation and the argument names are from the Linux kernel. Closes: #42
1 parent e764dd9 commit f6ee3b3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/mdns.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -713,18 +713,20 @@ mdns_strerror(int r, char *buf, size_t n)
713713
return os_strerror(r, buf, n);
714714
}
715715

716+
/* Test if string s ends in string sub
717+
* return 0 if match */
716718
static int
717-
strrcmp(const char *s1, const char *s2)
719+
strrcmp(const char *s, const char *sub)
718720
{
719721
size_t m, n;
720722

721-
if (!s1 || !s2)
723+
if (!s || !sub)
722724
return (1);
723-
m = strlen(s1);
724-
n = strlen(s2);
725+
m = strlen(s);
726+
n = strlen(sub);
725727
if (n > m)
726728
return (1);
727-
return (strncmp(s1 + m - n, s2, n));
729+
return (strncmp(s + m - n, sub, n));
728730
}
729731

730732
static int

0 commit comments

Comments
 (0)