Use '#pragma once' instead of include guard

The most compilers today do support the '#pragma once', which is
designed to cause the current source file to be included only once
in a single compilation. One has several advantages, including:
less code, avoidance of name clashes, and sometimes improvement
in compilation speed.

See: https://en.wikipedia.org/wiki/Pragma_once for details.
This commit is contained in:
Vadim Yanitskiy 2017-08-31 01:20:18 +07:00
parent 30209ceddd
commit 5f941573b0
7 changed files with 8 additions and 29 deletions

View File

@ -17,8 +17,7 @@
* along with gapk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSM_HR_H__
#define __GSM_HR_H__
#pragma once
#include <stdint.h>
@ -36,5 +35,3 @@ int gsmhr_decode(struct gsmhr *state, int16_t *pcm, const int16_t *hr_
#ifdef __cplusplus
}
#endif
#endif /* __GSM_HR_H__ */

View File

@ -1,6 +1,3 @@
#ifndef _BENCHMARK_H
#define _BENCHMARK_H
/*
* This file is part of gapk (GSM Audio Pocket Knife).
*
@ -20,6 +17,8 @@
* (C) 2014 Harald Welte <laforge@gnumonks.org>
*/
#pragma once
#include <osmocom/gapk/get_cycles.h>
#include <osmocom/gapk/codecs.h>
@ -56,5 +55,3 @@ static inline void benchmark_stop(enum codec_type codec, int encode, unsigned lo
} while (0)
void benchmark_dump(void);
#endif

View File

@ -17,8 +17,7 @@
* along with gapk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GAPK_CODECS_H__
#define __GAPK_CODECS_H__
#pragma once
#include <stdint.h>
@ -67,5 +66,3 @@ struct codec_desc {
};
const struct codec_desc *codec_get_from_type(enum codec_type type);
#endif /* __GAPK_CODECS_H__ */

View File

@ -17,8 +17,7 @@
* along with gapk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GAPK_FORMATS_H__
#define __GAPK_FORMATS_H__
#pragma once
#include <stdint.h>
@ -90,5 +89,3 @@ struct format_desc {
const struct format_desc *fmt_get_from_type(enum format_type type);
const struct format_desc *fmt_get_from_name(const char *name);
#endif /* __GAPK_FORMATS_H__ */

View File

@ -33,8 +33,7 @@
* $Id$
*/
#ifndef GET_CLOCK_H
#define GET_CLOCK_H
#pragma once
#if 0
@ -134,5 +133,3 @@ static inline cycles_t get_cycles()
#endif
extern double get_cpu_mhz(void);
#endif /* GET_CLOCK_H */

View File

@ -17,8 +17,7 @@
* along with gapk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GAPK_PROCQUEUE_H__
#define __GAPK_PROCQUEUE_H__
#pragma once
#include <stdint.h>
#include <stdio.h> /* for FILE */
@ -68,5 +67,3 @@ int pq_queue_fmt_convert(struct pq *pq, const struct format_desc *fmt, int to_fr
/* Codec */
struct codec_desc;
int pq_queue_codec(struct pq *pq, const struct codec_desc *codec, int encode);
#endif /* __GAPK_PROCQUEUE_H__ */

View File

@ -17,8 +17,7 @@
* along with gapk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GAPK_UTILS_H__
#define __GAPK_UTILS_H__
#pragma once
#include <stdint.h>
@ -100,5 +99,3 @@ lsb_clr_bit(uint8_t *buf, int bn)
buf[pos_byte] &= ~(1 << pos_bit);
}
#endif /* __GAPK_UTILS_H__ */