From 50cf8db086732347b20a9b7c21804b458e3c45e2 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 6 Sep 2015 11:39:55 -0500 Subject: [PATCH] libpkgconf: clean up PKG_MODULE_SEPARATOR() and PKG_OPERATOR_CHAR() macros --- libpkgconf/dependency.c | 16 ++++++++-------- libpkgconf/libpkgconf.h | 4 ++-- main.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libpkgconf/dependency.c b/libpkgconf/dependency.c index 1e2a116..32bd039 100644 --- a/libpkgconf/dependency.c +++ b/libpkgconf/dependency.c @@ -106,7 +106,7 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends) switch (state) { case OUTSIDE_MODULE: - if (!PKG_MODULE_SEPARATOR(*ptr)) + if (!PKGCONF_IS_MODULE_SEPARATOR(*ptr)) state = INSIDE_MODULE_NAME; break; @@ -121,14 +121,14 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends) if (*sptr == '\0') state = OUTSIDE_MODULE; - else if (PKG_MODULE_SEPARATOR(*sptr)) + else if (PKGCONF_IS_MODULE_SEPARATOR(*sptr)) state = OUTSIDE_MODULE; - else if (PKG_OPERATOR_CHAR(*sptr)) + else if (PKGCONF_IS_OPERATOR_CHAR(*sptr)) state = BEFORE_OPERATOR; else state = OUTSIDE_MODULE; } - else if (PKG_MODULE_SEPARATOR(*ptr)) + else if (PKGCONF_IS_MODULE_SEPARATOR(*ptr)) state = OUTSIDE_MODULE; else if (*(ptr + 1) == '\0') { @@ -140,7 +140,7 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends) { char *iter = start; - while (PKG_MODULE_SEPARATOR(*iter)) + while (PKGCONF_IS_MODULE_SEPARATOR(*iter)) iter++; package = iter; @@ -163,7 +163,7 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends) break; case BEFORE_OPERATOR: - if (PKG_OPERATOR_CHAR(*ptr)) + if (PKGCONF_IS_OPERATOR_CHAR(*ptr)) { state = INSIDE_OPERATOR; *cnameptr++ = *ptr; @@ -172,7 +172,7 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends) break; case INSIDE_OPERATOR: - if (!PKG_OPERATOR_CHAR(*ptr)) + if (!PKGCONF_IS_OPERATOR_CHAR(*ptr)) { state = AFTER_OPERATOR; compare = pkgconf_pkg_comparator_lookup_by_name(cmpname); @@ -195,7 +195,7 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends) break; case INSIDE_VERSION: - if (PKG_MODULE_SEPARATOR(*ptr) || *(ptr + 1) == '\0') + if (PKGCONF_IS_MODULE_SEPARATOR(*ptr) || *(ptr + 1) == '\0') { version = vstart; version_sz = ptr - vstart; diff --git a/libpkgconf/libpkgconf.h b/libpkgconf/libpkgconf.h index 1c6be94..11cc652 100644 --- a/libpkgconf/libpkgconf.h +++ b/libpkgconf/libpkgconf.h @@ -104,8 +104,8 @@ struct pkgconf_pkg_ { unsigned int flags; }; -#define PKG_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c))) -#define PKG_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=') +#define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c))) +#define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=') #define PKGF_NONE 0x000 #define PKGF_SEARCH_PRIVATE 0x001 diff --git a/main.c b/main.c index 4292bf7..c3054d8 100644 --- a/main.c +++ b/main.c @@ -848,7 +848,7 @@ main(int argc, char *argv[]) continue; } - if (argv[pkg_optind + 1] == NULL || !PKG_OPERATOR_CHAR(*(argv[pkg_optind + 1]))) + if (argv[pkg_optind + 1] == NULL || !PKGCONF_IS_OPERATOR_CHAR(*(argv[pkg_optind + 1]))) { pkgconf_queue_push(&pkgq, package); pkg_optind++;