From 6b8d8395b642bbae25cb55b963070ab41894c323 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 27 Jan 2010 06:59:02 -0700 Subject: [PATCH] maint: avoid excess parens in STREQ * src/internal.h (STREQ, STRCASEEQ, STRNEQ, STRCASENEQ, STREQLEN) (STRCASEEQLEN, STRNEQLEN, STRCASENEQLEN, STRPREFIX): Avoid redundant parenthesis. * examples/domain-events/events-c/event-test.c (STREQ): Likewise. * src/storage/parthelper.c (STREQ): Likewise. --- examples/domain-events/events-c/event-test.c | 2 +- src/internal.h | 18 +++++++++--------- src/storage/parthelper.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index b2eb1d5265..e8f5505b5c 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -14,7 +14,7 @@ __func__, __LINE__) #define DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", \ __func__, __LINE__, __VA_ARGS__) -#define STREQ(a,b) (strcmp((a),(b)) == 0) +#define STREQ(a,b) (strcmp(a,b) == 0) #ifndef ATTRIBUTE_UNUSED #define ATTRIBUTE_UNUSED __attribute__((__unused__)) diff --git a/src/internal.h b/src/internal.h index 5ca1fa36ee..ec8a49f0c7 100644 --- a/src/internal.h +++ b/src/internal.h @@ -48,15 +48,15 @@ #define N_(str) dgettext(GETTEXT_PACKAGE, (str)) /* String equality tests, suggested by Jim Meyering. */ -#define STREQ(a,b) (strcmp((a),(b)) == 0) -#define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0) -#define STRNEQ(a,b) (strcmp((a),(b)) != 0) -#define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0) -#define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0) -#define STRCASEEQLEN(a,b,n) (strncasecmp((a),(b),(n)) == 0) -#define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0) -#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0) -#define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0) +#define STREQ(a,b) (strcmp(a,b) == 0) +#define STRCASEEQ(a,b) (strcasecmp(a,b) == 0) +#define STRNEQ(a,b) (strcmp(a,b) != 0) +#define STRCASENEQ(a,b) (strcasecmp(a,b) != 0) +#define STREQLEN(a,b,n) (strncmp(a,b,n) == 0) +#define STRCASEEQLEN(a,b,n) (strncasecmp(a,b,n) == 0) +#define STRNEQLEN(a,b,n) (strncmp(a,b,n) != 0) +#define STRCASENEQLEN(a,b,n) (strncasecmp(a,b,n) != 0) +#define STRPREFIX(a,b) (strncmp(a,b,strlen(b)) == 0) #define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0) #define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c index ab04842273..5626cd2125 100644 --- a/src/storage/parthelper.c +++ b/src/storage/parthelper.c @@ -10,7 +10,7 @@ * in a reliable fashion if merely after a list of partitions & sizes, * though it is fine for creating partitions. * - * Copyright (C) 2007-2008 Red Hat, Inc. + * Copyright (C) 2007-2008, 2010 Red Hat, Inc. * Copyright (C) 2007-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -37,7 +37,7 @@ #include /* we don't need to include the full internal.h just for this */ -#define STREQ(a,b) (strcmp((a),(b)) == 0) +#define STREQ(a,b) (strcmp(a,b) == 0) /* Make the comparisons below fail if your parted headers are so old that they lack the definition. */