summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel McCallum <npmccallum@redhat.com>2016-05-24 10:18:43 -0400
committerMartin Basti <mbasti@redhat.com>2016-05-29 14:04:45 +0200
commit4bafba06f2b8cc51cd95a725e1c8adf7bbf9a5fc (patch)
tree25c3e7a633daac2d6e08a7031580f9d12b0cadf4
parent9cbb54db99eb1855a5c840699072ead9b6d75d04 (diff)
downloadfreeipa-4bafba06f2b8cc51cd95a725e1c8adf7bbf9a5fc.tar.gz
freeipa-4bafba06f2b8cc51cd95a725e1c8adf7bbf9a5fc.tar.xz
freeipa-4bafba06f2b8cc51cd95a725e1c8adf7bbf9a5fc.zip
Migrate from #ifndef guards to #pragma once
Using a pragma instead of guards is easier to write, less error prone and avoids name clashes (a source of very subtle bugs). This pragma is supported on almost all compilers, including all the compilers we care about: https://en.wikipedia.org/wiki/Pragma_once#Portability. This patch does not change the autogenerated files: asn1/asn1c/*.h. Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
-rw-r--r--asn1/ipa_asn1.h5
-rw-r--r--client/ipa-client-common.h5
-rw-r--r--daemons/ipa-kdb/ipa_kdb_mspac_private.h6
-rw-r--r--daemons/ipa-otpd/internal.h5
-rw-r--r--daemons/ipa-sam/ipa_sam.h5
-rw-r--r--daemons/ipa-slapi-plugins/common/util.h5
-rw-r--r--daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h4
-rw-r--r--daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h4
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h6
-rw-r--r--daemons/ipa-slapi-plugins/ipa-sidgen/ipa_sidgen.h4
-rw-r--r--daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h5
-rw-r--r--util/ipa_krb5.h4
-rw-r--r--util/ipa_mspac.h5
-rw-r--r--util/ipa_pwd.h5
14 files changed, 14 insertions, 54 deletions
diff --git a/asn1/ipa_asn1.h b/asn1/ipa_asn1.h
index 6ffcc5cc8..089a5e520 100644
--- a/asn1/ipa_asn1.h
+++ b/asn1/ipa_asn1.h
@@ -1,5 +1,4 @@
-#ifndef __IPA_ASN1_H_
-#define __IPA_ASN1_H_
+#pragma once
#include "ipa_krb5.h"
@@ -72,5 +71,3 @@ bool ipaasn1_dec_getkt(void *buf, size_t len, bool *newkt,
*/
bool ipaasn1_dec_getktreply(void *buf, size_t len,
int *kvno, struct keys_container *keys);
-
-#endif /* __IPA_ASN1_H_ */
diff --git a/client/ipa-client-common.h b/client/ipa-client-common.h
index e831c596c..d0db0637e 100644
--- a/client/ipa-client-common.h
+++ b/client/ipa-client-common.h
@@ -17,8 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __IPA_CLIENT_COMMON_H
-#define __IPA_CLIENT_COMMON_H
+#pragma once
#include <libintl.h>
#define _(STRING) gettext(STRING)
@@ -29,5 +28,3 @@
#endif
int init_gettext(void);
-
-#endif /* __IPA_CLIENT_COMMON_H */
diff --git a/daemons/ipa-kdb/ipa_kdb_mspac_private.h b/daemons/ipa-kdb/ipa_kdb_mspac_private.h
index be0407176..1052bb882 100644
--- a/daemons/ipa-kdb/ipa_kdb_mspac_private.h
+++ b/daemons/ipa-kdb/ipa_kdb_mspac_private.h
@@ -21,9 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-#ifndef _IPA_KDB_MSPAC_PRIVATE_H_
-#define _IPA_KDB_MSPAC_PRIVATE_H_
+#pragma once
struct ipadb_mspac {
char *flat_domain_name;
@@ -53,5 +51,3 @@ struct ipadb_adtrusts {
int string_to_sid(const char *str, struct dom_sid *sid);
char *dom_sid_string(TALLOC_CTX *memctx, const struct dom_sid *dom_sid);
-
-#endif /* _IPA_KDB_MSPAC_PRIVATE_H_ */
diff --git a/daemons/ipa-otpd/internal.h b/daemons/ipa-otpd/internal.h
index 5ab4a7776..43096edf0 100644
--- a/daemons/ipa-otpd/internal.h
+++ b/daemons/ipa-otpd/internal.h
@@ -20,8 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef INTERNAL_H_
-#define INTERNAL_H_
+#pragma once
#include "krad.h"
@@ -149,5 +148,3 @@ const char *otpd_parse_radius(LDAP *ldp, LDAPMessage *entry,
const char *otpd_parse_radius_username(LDAP *ldp, LDAPMessage *entry,
struct otpd_queue_item *item);
-
-#endif /* INTERNAL_H_ */
diff --git a/daemons/ipa-sam/ipa_sam.h b/daemons/ipa-sam/ipa_sam.h
index 46e6ffe1a..9e20ffac5 100644
--- a/daemons/ipa-sam/ipa_sam.h
+++ b/daemons/ipa-sam/ipa_sam.h
@@ -18,11 +18,8 @@
*/
-#ifndef _PASSDB_PDB_IPA_H_
-#define _PASSDB_PDB_IPA_H_
+#pragma once
/* The following definitions come from passdb/pdb_ipa.c */
NTSTATUS pdb_ipa_init(void);
-
-#endif /* _PASSDB_PDB_IPA_H_ */
diff --git a/daemons/ipa-slapi-plugins/common/util.h b/daemons/ipa-slapi-plugins/common/util.h
index eb3ddc0b9..1eaf47fac 100644
--- a/daemons/ipa-slapi-plugins/common/util.h
+++ b/daemons/ipa-slapi-plugins/common/util.h
@@ -34,8 +34,7 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
-#ifndef _SLAPI_PLUGINS_UTIL_H
-#define _SLAPI_PLUGINS_UTIL_H
+#pragma once
#define EOK 0
#define EFAIL -1
@@ -72,5 +71,3 @@
slapi_log_error(SLAPI_LOG_TRACE, log_func, fmt, ##__VA_ARGS__)
#define LOG_OOM() LOG_FATAL("Out of Memory!\n")
-
-#endif /* _SLAPI_PLUGINS_UTIL_H */
diff --git a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h
index 5e963e3f8..a3ebfbfe2 100644
--- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h
+++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h
@@ -37,8 +37,7 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
-#ifndef _IPA_CLDAP_H_
-#define _IPA_CLDAP_H_
+#pragma once
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -108,4 +107,3 @@ int ipa_cldap_netlogon(struct ipa_cldap_ctx *ctx,
struct berval *reply);
char *make_netbios_name(TALLOC_CTX *mem_ctx, const char *s);
-#endif /* _IPA_CLDAP_H_ */
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h
index a77711977..e121b8ba5 100644
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom.h
@@ -37,8 +37,7 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
-#ifndef _IPA_EXTDOM_H_
-#define _IPA_EXTDOM_H_
+#pragma once
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -202,4 +201,3 @@ int pack_ber_group(enum response_types response_type,
gid_t gid, char **members, struct sss_nss_kv *kv_list,
struct berval **berval);
void set_err_msg(struct extdom_req *req, const char *format, ...);
-#endif /* _IPA_EXTDOM_H_ */
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h b/daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h
index 4cbc17b99..51d77a0b5 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h
@@ -37,9 +37,7 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
-
-#ifndef OTPCTRL_H_
-#define OTPCTRL_H_
+#pragma once
#include "../libotp/otp_config.h"
#include <stdbool.h>
@@ -62,5 +60,3 @@ bool otpctrl_present(Slapi_PBlock *pb, const char *oid);
bool otpctrl_sync_handle(const struct otp_config *cfg, Slapi_PBlock *pb,
const char *user_dn);
-
-#endif /* OTPCTRL_H_ */
diff --git a/daemons/ipa-slapi-plugins/ipa-sidgen/ipa_sidgen.h b/daemons/ipa-slapi-plugins/ipa-sidgen/ipa_sidgen.h
index dec2a6524..0feff7eec 100644
--- a/daemons/ipa-slapi-plugins/ipa-sidgen/ipa_sidgen.h
+++ b/daemons/ipa-slapi-plugins/ipa-sidgen/ipa_sidgen.h
@@ -37,8 +37,7 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
-#ifndef _IPA_SIDGEN_H_
-#define _IPA_SIDGEN_H_
+#pragma once
#define OBJECTCLASS "objectclass"
#define IPA_OBJECT "ipaobject"
@@ -105,4 +104,3 @@ int find_sid_for_ldap_entry(struct slapi_entry *entry,
const char *base_dn,
const char *dom_sid,
struct range_info **ranges);
-#endif /* _IPA_SIDGEN_H_ */
diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h
index 664af32a7..a3200b00e 100644
--- a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h
+++ b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h
@@ -37,8 +37,7 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
-#ifndef IPA_WINSYNC_H
-#define IPA_WINSYNC_H
+#pragma once
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -172,5 +171,3 @@ enum {
#define IPA_WINSYNC_UPG_DEF_DN "cn=UPG Definition,cn=Definitions,cn=Managed Entries,cn=etc,%s"
#define IPA_WINSYNC_UPG_DEF_ATTR "originfilter"
#define IPA_WINSYNC_UPG_DEF_DISABLED "(objectclass=disable)"
-
-#endif /* IPA_WINSYNC_H */
diff --git a/util/ipa_krb5.h b/util/ipa_krb5.h
index c2a0dde2d..60a8ced5d 100644
--- a/util/ipa_krb5.h
+++ b/util/ipa_krb5.h
@@ -1,5 +1,4 @@
-#ifndef __IPA_KRB5_H_
-#define __IPA_KRB5_H_
+#pragma once
#include <lber.h>
#include <krb5/krb5.h>
@@ -83,4 +82,3 @@ int create_keys(krb5_context krbctx,
char **err_msg);
int ipa_kstuples_to_string(krb5_key_salt_tuple *kst, int n_kst, char **str);
-#endif /* __IPA_KRB5_H_ */
diff --git a/util/ipa_mspac.h b/util/ipa_mspac.h
index 152317b18..00a8f0d31 100644
--- a/util/ipa_mspac.h
+++ b/util/ipa_mspac.h
@@ -1,5 +1,4 @@
-#ifndef __IPA_MSPAC_H_
-#define __IPA_MSPAC_H_
+#pragma once
char *ipa_mspac_well_known_sids[] = {
"S-1-0",
@@ -28,5 +27,3 @@ char *ipa_mspac_well_known_sids[] = {
"S-1-5-20",
NULL
};
-
-#endif /* __IPA_MSPAC_H_ */
diff --git a/util/ipa_pwd.h b/util/ipa_pwd.h
index bc07549cc..15041c4e5 100644
--- a/util/ipa_pwd.h
+++ b/util/ipa_pwd.h
@@ -20,8 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _IPA_PWD_H_
-#define _IPA_PWD_H_
+#pragma once
/* 90 days default pwd max lifetime */
#define IPAPWD_DEFAULT_PWDLIFE (90 * 24 *3600)
@@ -75,5 +74,3 @@ int ipapwd_generate_new_history(char *password,
int *new_pwd_hlen);
int encode_nt_key(char *newPasswd, uint8_t *nt_key);
-
-#endif