We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 662799b + c4a91b6 commit eecc240Copy full SHA for eecc240
1 file changed
src/nvme/fabrics.c
@@ -47,13 +47,19 @@ const char *nvmf_dev = "/dev/nvme-fabrics";
47
48
/**
49
* strchomp() - Strip trailing white space
50
- * @s: String to strip
51
- * @l: Maximum length of string
+ * @str: String to strip
+ * @max: Maximum length of string
52
*/
53
-static void strchomp(char *s, int l)
+static void strchomp(char *str, int max)
54
{
55
- while (l && (s[l] == '\0' || s[l] == ' '))
56
- s[l--] = '\0';
+ int i;
+
57
+ for (i = max - 1; i >= 0; i--) {
58
+ if (str[i] != '\0' && str[i] != ' ')
59
+ return;
60
+ else
61
+ str[i] = '\0';
62
+ }
63
}
64
65
const char *arg_str(const char * const *strings,
0 commit comments