String intersection

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

 



Hi,

Is there a function in the kernel that does string intersection?
Functions in string.c doesn't seem to do what I want, e.g.:

+#include <linux/string.h>
+
+/* AND'ing two strings (checks intersection) */
+static int strand(char *s1, char *s2)
+{
+	int i, j;
+	int slen1 = strlen(s1);
+	int slen2 = strlen(s2);
+
+	for(i = 0; i < slen1; i++)
+		for(j = 0; j < slen2; j++)
+			if (s1[i] == s2[j])
+        		        return 1;
+    return 0;
+}


Thanks,
Bahadir

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux