summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-09-15 13:11:45 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-09-19 12:08:08 +0100
commita171dc6e639a60a5bd48b360558615ef4bedd011 (patch)
treed7969b10a261bae2b2651d65898b1199991899f3
parent2f23aa1c67da5148284c0026ef4d9f20c2917f9b (diff)
downloadlibguestfs-a171dc6e639a60a5bd48b360558615ef4bedd011.tar.gz
libguestfs-a171dc6e639a60a5bd48b360558615ef4bedd011.tar.xz
libguestfs-a171dc6e639a60a5bd48b360558615ef4bedd011.zip
syntax: Use STREQ/STRNEQ in place of strcmp.
Found by 'make syntax-check'. (cherry picked from commit b0cefb417d01c6dcb87cc6bafe9c19b98c690c9d)
-rw-r--r--generator/generator_perl.ml4
-rw-r--r--src/inspect-fs-unix.c2
-rw-r--r--tests/regressions/rhbz790721.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/generator/generator_perl.ml b/generator/generator_perl.ml
index 4a8011a3..fa7d8528 100644
--- a/generator/generator_perl.ml
+++ b/generator/generator_perl.ml
@@ -47,6 +47,8 @@ let rec generate_perl_xs () =
#include <guestfs.h>
+#define STREQ(a,b) (strcmp((a),(b)) == 0)
+
static SV *
my_newSVll(long long val) {
#ifdef USE_64_BIT_ALL
@@ -434,7 +436,7 @@ user_cancel (g)
fun argt ->
let n = name_of_optargt argt in
let uc_n = String.uppercase n in
- pr "if (strcmp (this_arg, \"%s\") == 0) {\n" n;
+ pr "if (STREQ (this_arg, \"%s\")) {\n" n;
pr " optargs_s.%s = " n;
(match argt with
| OBool _
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 433ef5ce..d9bf5bf6 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -1073,7 +1073,7 @@ mdadm_app_cmp(const void *x, const void *y)
const mdadm_app *a = x;
const mdadm_app *b = y;
- return strcmp(a->mdadm, b->mdadm) == 0;
+ return STREQ (a->mdadm, b->mdadm);
}
static void
diff --git a/tests/regressions/rhbz790721.c b/tests/regressions/rhbz790721.c
index 844631ff..7d5c266c 100644
--- a/tests/regressions/rhbz790721.c
+++ b/tests/regressions/rhbz790721.c
@@ -184,7 +184,7 @@ start_thread (void *vi)
* building code which is what this regression test is designed to
* spot.
*/
- if (strcmp (error, "child process died unexpectedly") != 0) {
+ if (STRNEQ (error, "child process died unexpectedly")) {
fprintf (stderr, "rhbz790721: [thread %d]: error: %s\n", thread_id, error);
*(int *)vi = -1;
pthread_exit (vi);