Skip to content

Commit 404e9e5

Browse files
WillAydmroeschke
authored andcommitted
CLN: Use #pragma once instead of include guards (pandas-dev#52635)
Use #pragma once
1 parent dc7f881 commit 404e9e5

File tree

12 files changed

+12
-46
lines changed

12 files changed

+12
-46
lines changed

pandas/_libs/pd_parser.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ All rights reserved.
66
Distributed under the terms of the BSD Simplified License.
77
88
*/
9-
#ifndef PANDAS__LIBS_PD_PARSER_H_
10-
#define PANDAS__LIBS_PD_PARSER_H_
9+
#pragma once
1110

1211
#ifdef __cplusplus
1312
extern "C" {
@@ -110,4 +109,3 @@ static PandasParser_CAPI *PandasParserAPI = NULL;
110109
#ifdef __cplusplus
111110
}
112111
#endif
113-
#endif // PANDAS__LIBS_PD_PARSER_H_

pandas/_libs/src/headers/portable.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef _PANDAS_PORTABLE_H_
2-
#define _PANDAS_PORTABLE_H_
1+
#pragma once
32

43
#include <string.h>
54

@@ -14,5 +13,3 @@
1413
#define isspace_ascii(c) (((c) == ' ') || (((unsigned)(c) - '\t') < 5))
1514
#define toupper_ascii(c) ((((unsigned)(c) - 'a') < 26) ? ((c) & 0x5f) : (c))
1615
#define tolower_ascii(c) ((((unsigned)(c) - 'A') < 26) ? ((c) | 0x20) : (c))
17-
18-
#endif

pandas/_libs/src/inline_helper.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Distributed under the terms of the BSD Simplified License.
77
The full license is in the LICENSE file, distributed with this software.
88
*/
99

10-
#ifndef PANDAS__LIBS_SRC_INLINE_HELPER_H_
11-
#define PANDAS__LIBS_SRC_INLINE_HELPER_H_
10+
#pragma once
1211

1312
#ifndef PANDAS_INLINE
1413
#if defined(__clang__)
@@ -23,5 +22,3 @@ The full license is in the LICENSE file, distributed with this software.
2322
#define PANDAS_INLINE
2423
#endif // __GNUC__
2524
#endif // PANDAS_INLINE
26-
27-
#endif // PANDAS__LIBS_SRC_INLINE_HELPER_H_

pandas/_libs/src/parser/io.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Distributed under the terms of the BSD Simplified License.
77
The full license is in the LICENSE file, distributed with this software.
88
*/
99

10-
#ifndef PANDAS__LIBS_SRC_PARSER_IO_H_
11-
#define PANDAS__LIBS_SRC_PARSER_IO_H_
10+
#pragma once
1211

1312
#define PY_SSIZE_T_CLEAN
1413
#include <Python.h>
@@ -30,5 +29,3 @@ int del_rd_source(void *src);
3029

3130
void *buffer_rd_bytes(void *source, size_t nbytes, size_t *bytes_read,
3231
int *status, const char *encoding_errors);
33-
34-
#endif // PANDAS__LIBS_SRC_PARSER_IO_H_

pandas/_libs/src/parser/tokenizer.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ See LICENSE for the license
99
1010
*/
1111

12-
#ifndef PANDAS__LIBS_SRC_PARSER_TOKENIZER_H_
13-
#define PANDAS__LIBS_SRC_PARSER_TOKENIZER_H_
12+
#pragma once
1413

1514
#define PY_SSIZE_T_CLEAN
1615
#include <Python.h>
@@ -232,5 +231,3 @@ double precise_xstrtod(const char *p, char **q, char decimal,
232231
double round_trip(const char *p, char **q, char decimal, char sci, char tsep,
233232
int skip_trailing, int *error, int *maybe_int);
234233
int to_boolean(const char *item, uint8_t *val);
235-
236-
#endif // PANDAS__LIBS_SRC_PARSER_TOKENIZER_H_

pandas/_libs/src/skiplist.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Port of Wes McKinney's Cython version of Raymond Hettinger's original pure
1313
Python recipe (https://rhettinger.wordpress.com/2010/02/06/lost-knowledge/)
1414
*/
1515

16-
#ifndef PANDAS__LIBS_SRC_SKIPLIST_H_
17-
#define PANDAS__LIBS_SRC_SKIPLIST_H_
16+
#pragma once
1817

1918
#include <math.h>
2019
#include <stdio.h>
@@ -296,5 +295,3 @@ PANDAS_INLINE int skiplist_remove(skiplist_t *skp, double value) {
296295
--(skp->size);
297296
return 1;
298297
}
299-
300-
#endif // PANDAS__LIBS_SRC_SKIPLIST_H_

pandas/_libs/src/ujson/lib/ultrajson.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ tree doesn't have cyclic references.
4949
5050
*/
5151

52-
#ifndef PANDAS__LIBS_SRC_UJSON_LIB_ULTRAJSON_H_
53-
#define PANDAS__LIBS_SRC_UJSON_LIB_ULTRAJSON_H_
52+
#pragma once
5453

5554
#include <stdio.h>
5655
#include <wchar.h>
@@ -313,5 +312,3 @@ typedef struct __JSONObjectDecoder {
313312
EXPORTFUNCTION JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec,
314313
const char *buffer, size_t cbBuffer);
315314
EXPORTFUNCTION void encode(JSOBJ, JSONObjectEncoder *, const char *, size_t);
316-
317-
#endif // PANDAS__LIBS_SRC_UJSON_LIB_ULTRAJSON_H_

pandas/_libs/src/ujson/python/version.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ Numeric decoder derived from TCL library
3535
* Copyright (c) 1994 Sun Microsystems, Inc.
3636
*/
3737

38-
#ifndef PANDAS__LIBS_SRC_UJSON_PYTHON_VERSION_H_
39-
#define PANDAS__LIBS_SRC_UJSON_PYTHON_VERSION_H_
38+
#pragma once
4039

4140
#define UJSON_VERSION "1.33"
42-
43-
#endif // PANDAS__LIBS_SRC_UJSON_PYTHON_VERSION_H_

pandas/_libs/tslibs/src/datetime/date_conversions.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ Distributed under the terms of the BSD Simplified License.
55
The full license is in the LICENSE file, distributed with this software.
66
*/
77

8-
#ifndef PANDAS__LIBS_TSLIBS_SRC_DATETIME_DATE_CONVERSIONS_H_
9-
#define PANDAS__LIBS_TSLIBS_SRC_DATETIME_DATE_CONVERSIONS_H_
8+
#pragma once
109

1110
#define PY_SSIZE_T_CLEAN
1211
#include <Python.h>
@@ -35,5 +34,3 @@ char *PyDateTimeToIso(PyObject *obj, NPY_DATETIMEUNIT base, size_t *len);
3534
npy_datetime PyDateTimeToEpoch(PyObject *dt, NPY_DATETIMEUNIT base);
3635

3736
char *int64ToIsoDuration(int64_t value, size_t *len);
38-
39-
#endif // PANDAS__LIBS_TSLIBS_SRC_DATETIME_DATE_CONVERSIONS_H_

pandas/_libs/tslibs/src/datetime/np_datetime.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ This file is derived from NumPy 1.7. See NUMPY_LICENSE.txt
1414
1515
*/
1616

17-
#ifndef PANDAS__LIBS_TSLIBS_SRC_DATETIME_NP_DATETIME_H_
18-
#define PANDAS__LIBS_TSLIBS_SRC_DATETIME_NP_DATETIME_H_
17+
#pragma once
1918

2019
#ifndef NPY_NO_DEPRECATED_API
2120
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
@@ -114,6 +113,3 @@ add_minutes_to_datetimestruct(npy_datetimestruct *dts, int minutes);
114113
*/
115114
PyArray_DatetimeMetaData get_datetime_metadata_from_dtype(
116115
PyArray_Descr *dtype);
117-
118-
119-
#endif // PANDAS__LIBS_TSLIBS_SRC_DATETIME_NP_DATETIME_H_

pandas/_libs/tslibs/src/datetime/np_datetime_strings.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ This file implements string parsing and creation for NumPy datetime.
1919
2020
*/
2121

22-
#ifndef PANDAS__LIBS_TSLIBS_SRC_DATETIME_NP_DATETIME_STRINGS_H_
23-
#define PANDAS__LIBS_TSLIBS_SRC_DATETIME_NP_DATETIME_STRINGS_H_
22+
#pragma once
2423

2524
#ifndef NPY_NO_DEPRECATED_API
2625
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
@@ -108,4 +107,3 @@ make_iso_8601_datetime(npy_datetimestruct *dts, char *outstr, int outlen,
108107
*/
109108
int make_iso_8601_timedelta(pandas_timedeltastruct *tds, char *outstr,
110109
size_t *outlen);
111-
#endif // PANDAS__LIBS_TSLIBS_SRC_DATETIME_NP_DATETIME_STRINGS_H_

pandas/_libs/tslibs/src/datetime/pd_datetime.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ All rights reserved.
1515
See NUMPY_LICENSE.txt for the license.
1616
*/
1717

18-
#ifndef PANDAS__LIBS_TSLIBS_SRC_DATETIME_PD_DATETIME_H_
19-
#define PANDAS__LIBS_TSLIBS_SRC_DATETIME_PD_DATETIME_H_
18+
#pragma once
2019

2120
#ifndef NPY_NO_DEPRECATED_API
2221
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
@@ -112,4 +111,3 @@ static PandasDateTime_CAPI *PandasDateTimeAPI = NULL;
112111
#ifdef __cplusplus
113112
}
114113
#endif
115-
#endif // PANDAS__LIBS_TSLIBS_SRC_DATETIME_PD_DATETIME_H_

0 commit comments

Comments
 (0)