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>
This commit is contained in:
Nathaniel McCallum 2016-05-24 10:18:43 -04:00 committed by Martin Basti
parent 9cbb54db99
commit 4bafba06f2
14 changed files with 14 additions and 54 deletions

View File

@ -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_ */

View File

@ -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 */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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 */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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 */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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