Thread (21 messages) 21 messages, 3 authors, 2016-03-15

RE: [ethtool PATCH v4 10/11] ethtool.c: add support for ETHTOOL_xLINKSETTINGS ioctls

flat view

From: David Laight <hidden>
Date: 2016-03-14 16:47:21

quoted
+	/* ignore optional '0x' prefix */
+	if ((slen > 2) && (
Unnecessary ().
quoted
+		    (0 == memcmp(s, "0x", 2)
+		     || (0 == memcmp(s, "0X", 2))))) {
A-about-F comparisons.
memcmp() is a really poor tool for comparing strings.  You should use
strncasecmp() here.
Even that is overkill, why not just:
	if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help