mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
change strncmp(...) != 0 to STRNEQLEN(...)
git grep -l 'strncmp *([^=]*!= *0'|xargs \ perl -pi -e 's/\bstrncmp( *\(.*?\)) *!= *0/STRNEQLEN$1/g'
This commit is contained in:
@@ -164,7 +164,7 @@ extern void reply (xdrproc_t xdrp, char *ret);
|
||||
*/
|
||||
#define RESOLVE_DEVICE(path,fail_stmt) \
|
||||
do { \
|
||||
if (strncmp ((path), "/dev/", 5) != 0) { \
|
||||
if (STRNEQLEN ((path), "/dev/", 5)) { \
|
||||
reply_with_error ("%s: %s: expecting a device name", __func__, (path)); \
|
||||
fail_stmt; \
|
||||
} \
|
||||
|
||||
@@ -945,7 +945,7 @@ device_name_translation (char *device, const char *func)
|
||||
}
|
||||
|
||||
/* If the name begins with "/dev/sd" then try the alternatives. */
|
||||
if (strncmp (device, "/dev/sd", 7) != 0)
|
||||
if (STRNEQLEN (device, "/dev/sd", 7))
|
||||
goto error;
|
||||
|
||||
device[5] = 'h'; /* /dev/hd (old IDE driver) */
|
||||
|
||||
@@ -149,7 +149,7 @@ display_partitions (guestfs_h *g, const char *dev)
|
||||
* That's a limitation of sorts of the Linux kernel. (Actually,
|
||||
* we could do this if we add the kpartx program to libguestfs).
|
||||
*/
|
||||
if (strncmp (dev, "/dev/sd", 7) != 0 || isdigit (dev[strlen(dev)-1])) {
|
||||
if (STRNEQLEN (dev, "/dev/sd", 7) || isdigit (dev[strlen(dev)-1])) {
|
||||
printf ("<vm-image dev=\"%s\"/>\n", dev);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6146,7 +6146,7 @@ and generate_one_test_body name i test_name init test =
|
||||
pr " fprintf (stderr, \"%s: returned size of buffer wrong, expected %d but got %%zu\\n\", size);\n" test_name len;
|
||||
pr " return -1;\n";
|
||||
pr " }\n";
|
||||
pr " if (strncmp (r, expected, size) != 0) {\n";
|
||||
pr " if (STRNEQLEN (r, expected, size)) {\n";
|
||||
pr " fprintf (stderr, \"%s: expected \\\"%%s\\\" but got \\\"%%s\\\"\\n\", expected, r);\n" test_name;
|
||||
pr " return -1;\n";
|
||||
pr " }\n"
|
||||
|
||||
Reference in New Issue
Block a user