diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2013-12-09 22:06:40 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-03-14 14:16:33 +0100 |
commit | fa0938a6e3cb928602633c3da0b909deb269369d (patch) | |
tree | 6ebe9d9b79752f29a6587eaf5bb296d1e76b3837 /src/util | |
parent | 2bdadc5274df42738b97045cd01cd63d3651daf9 (diff) | |
download | sssd-fa0938a6e3cb928602633c3da0b909deb269369d.tar.gz sssd-fa0938a6e3cb928602633c3da0b909deb269369d.tar.xz sssd-fa0938a6e3cb928602633c3da0b909deb269369d.zip |
Use pattern #elif defined(identifier)
We had in source code following pattern #elif HAVE_<name>
It worked because undefined identifier(in some cases) was evaluated to 0.
But we do not care about value of HAVE_SOMETHING. We just need to know
whether identifier was defined.
There is not equivalent to #ifdef (short for of #if definded)
We need to use long form: #elif defined HAVE_<name>
It causes also compiler warning with enabled compiler flag -Wundef.
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/sss_endian.h | 2 | ||||
-rw-r--r-- | src/util/sss_ini.c | 22 | ||||
-rw-r--r-- | src/util/sss_krb5.h | 2 | ||||
-rw-r--r-- | src/util/sss_utf8.c | 8 |
4 files changed, 17 insertions, 17 deletions
diff --git a/src/util/sss_endian.h b/src/util/sss_endian.h index 952f8e1aa..834c35980 100644 --- a/src/util/sss_endian.h +++ b/src/util/sss_endian.h @@ -25,7 +25,7 @@ #ifdef HAVE_ENDIAN_H # include <endian.h> -#elif defined HAVE_SYS_ENDIAN_H +#elif defined(HAVE_SYS_ENDIAN_H) # include <sys/endian.h> #endif /* !HAVE_ENDIAN_H && !HAVE_SYS_ENDIAN_H */ diff --git a/src/util/sss_ini.c b/src/util/sss_ini.c index ce0d06755..5293ae93b 100644 --- a/src/util/sss_ini.c +++ b/src/util/sss_ini.c @@ -34,7 +34,7 @@ #ifdef HAVE_LIBINI_CONFIG_V1 #include "ini_configobj.h" -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) #include "collection.h" #include "collection_tools.h" #else @@ -61,7 +61,7 @@ struct sss_ini_initdata { -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) struct sss_ini_initdata { struct collection_item *error_list; @@ -99,7 +99,7 @@ void sss_ini_close_file(struct sss_ini_initdata *init_data) ini_config_file_destroy(init_data->file); init_data->file = NULL; } -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) if (init_data->file != -1) { close(init_data->file); init_data->file = -1; @@ -118,7 +118,7 @@ int sss_ini_config_file_open(struct sss_ini_initdata *init_data, return ini_config_file_open(config_file, INI_META_STATS, &init_data->file); -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) return check_and_open_readonly(config_file, &init_data->file, 0, 0, (S_IRUSR|S_IWUSR), CHECK_REG); #endif @@ -139,7 +139,7 @@ int sss_ini_config_access_check(struct sss_ini_initdata *init_data) 0, /* owned by root */ (S_IRUSR|S_IWUSR), /* rw------- */ 0); /* check all there parts */ -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) return EOK; #endif } @@ -156,7 +156,7 @@ int sss_ini_get_stat(struct sss_ini_initdata *init_data) if (!init_data->cstat) return EIO; return EOK; -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) return fstat(init_data->file, &init_data->cstat); #endif @@ -173,7 +173,7 @@ int sss_ini_get_mtime(struct sss_ini_initdata *init_data, #ifdef HAVE_LIBINI_CONFIG_V1 return snprintf(timestr, timestr_len, "%llu", (long long unsigned)init_data->cstat->st_mtime); -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) return snprintf(timestr, timestr_len, "%llu", (long long unsigned)init_data->cstat.st_mtime); #endif @@ -247,7 +247,7 @@ int sss_ini_get_config(struct sss_ini_initdata *init_data, return ret; -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) /* Read the configuration into a collection */ ret = config_from_fd("sssd", @@ -308,7 +308,7 @@ int sss_ini_get_int_config_value(struct sss_ini_initdata *init_data, { #ifdef HAVE_LIBINI_CONFIG_V1 return ini_get_int_config_value(init_data->obj, strict, def, error); -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) return get_int_config_value(init_data->obj, strict, def, error); #endif } @@ -325,7 +325,7 @@ void sss_ini_config_destroy(struct sss_ini_initdata *init_data) ini_config_destroy(init_data->sssd_config); init_data->sssd_config = NULL; } -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) free_ini_config(init_data->sssd_config); #endif } @@ -355,7 +355,7 @@ int sss_confdb_create_ldif(TALLOC_CTX *mem_ctx, size_t attr_len; #ifdef HAVE_LIBINI_CONFIG_V1 struct value_obj *obj = NULL; -#elif HAVE_LIBINI_CONFIG_V0 +#elif defined(HAVE_LIBINI_CONFIG_V0) struct collection_item *obj = NULL; #endif diff --git a/src/util/sss_krb5.h b/src/util/sss_krb5.h index 8838a9a6c..ee43f2983 100644 --- a/src/util/sss_krb5.h +++ b/src/util/sss_krb5.h @@ -160,7 +160,7 @@ sss_krb5_free_keytab_entry_contents(krb5_context context, #ifdef HAVE_KRB5_TICKET_TIMES typedef krb5_ticket_times sss_krb5_ticket_times; -#elif HAVE_KRB5_TIMES +#elif defined(HAVE_KRB5_TIMES) typedef krb5_times sss_krb5_ticket_times; #endif diff --git a/src/util/sss_utf8.c b/src/util/sss_utf8.c index 695230826..7ba11ca75 100644 --- a/src/util/sss_utf8.c +++ b/src/util/sss_utf8.c @@ -36,7 +36,7 @@ void sss_utf8_free(void *ptr) { return free(ptr); } -#elif HAVE_GLIB2 +#elif defined(HAVE_GLIB2) void sss_utf8_free(void *ptr) { return g_free(ptr); @@ -57,7 +57,7 @@ uint8_t *sss_utf8_tolower(const uint8_t *s, size_t len, size_t *_nlen) if (_nlen) *_nlen = llen; return lower; } -#elif HAVE_GLIB2 +#elif defined(HAVE_GLIB2) uint8_t *sss_utf8_tolower(const uint8_t *s, size_t len, size_t *_nlen) { gchar *glower; @@ -94,7 +94,7 @@ bool sss_utf8_check(const uint8_t *s, size_t n) return false; } -#elif HAVE_GLIB2 +#elif defined(HAVE_GLIB2) bool sss_utf8_check(const uint8_t *s, size_t n) { return g_utf8_validate((const gchar *)s, n, NULL); @@ -141,7 +141,7 @@ errno_t sss_utf8_case_eq(const uint8_t *s1, const uint8_t *s2) return ENOMATCH; } -#elif HAVE_GLIB2 +#elif defined(HAVE_GLIB2) errno_t sss_utf8_case_eq(const uint8_t *s1, const uint8_t *s2) { gchar *gs1; |