Skip to content

Commit fa07d05

Browse files
authored
Remove inline_helper.h header file (#56275)
* Remove inline_helper.h header file * missing fix
1 parent f43e7a5 commit fa07d05

File tree

6 files changed

+45
-72
lines changed

6 files changed

+45
-72
lines changed

pandas/_libs/include/pandas/inline_helper.h

-24
This file was deleted.

pandas/_libs/include/pandas/parser/tokenizer.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ See LICENSE for the license
1818
#define ERROR_OVERFLOW 2
1919
#define ERROR_INVALID_CHARS 3
2020

21-
#include "pandas/inline_helper.h"
2221
#include "pandas/portable.h"
2322
#include <stdint.h>
2423

pandas/_libs/include/pandas/skiplist.h

+14-15
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ Python recipe (https://rhettinger.wordpress.com/2010/02/06/lost-knowledge/)
1515

1616
#pragma once
1717

18-
#include "pandas/inline_helper.h"
1918
#include <math.h>
2019
#include <stdio.h>
2120
#include <stdlib.h>
2221
#include <string.h>
2322

24-
PANDAS_INLINE float __skiplist_nanf(void) {
23+
static inline float __skiplist_nanf(void) {
2524
const union {
2625
int __i;
2726
float __f;
@@ -30,7 +29,7 @@ PANDAS_INLINE float __skiplist_nanf(void) {
3029
}
3130
#define PANDAS_NAN ((double)__skiplist_nanf())
3231

33-
PANDAS_INLINE double Log2(double val) { return log(val) / log(2.); }
32+
static inline double Log2(double val) { return log(val) / log(2.); }
3433

3534
typedef struct node_t node_t;
3635

@@ -51,13 +50,13 @@ typedef struct {
5150
int maxlevels;
5251
} skiplist_t;
5352

54-
PANDAS_INLINE double urand(void) {
53+
static inline double urand(void) {
5554
return ((double)rand() + 1) / ((double)RAND_MAX + 2);
5655
}
5756

58-
PANDAS_INLINE int int_min(int a, int b) { return a < b ? a : b; }
57+
static inline int int_min(int a, int b) { return a < b ? a : b; }
5958

60-
PANDAS_INLINE node_t *node_init(double value, int levels) {
59+
static inline node_t *node_init(double value, int levels) {
6160
node_t *result;
6261
result = (node_t *)malloc(sizeof(node_t));
6362
if (result) {
@@ -78,9 +77,9 @@ PANDAS_INLINE node_t *node_init(double value, int levels) {
7877
}
7978

8079
// do this ourselves
81-
PANDAS_INLINE void node_incref(node_t *node) { ++(node->ref_count); }
80+
static inline void node_incref(node_t *node) { ++(node->ref_count); }
8281

83-
PANDAS_INLINE void node_decref(node_t *node) { --(node->ref_count); }
82+
static inline void node_decref(node_t *node) { --(node->ref_count); }
8483

8584
static void node_destroy(node_t *node) {
8685
int i;
@@ -100,7 +99,7 @@ static void node_destroy(node_t *node) {
10099
}
101100
}
102101

103-
PANDAS_INLINE void skiplist_destroy(skiplist_t *skp) {
102+
static inline void skiplist_destroy(skiplist_t *skp) {
104103
if (skp) {
105104
node_destroy(skp->head);
106105
free(skp->tmp_steps);
@@ -109,7 +108,7 @@ PANDAS_INLINE void skiplist_destroy(skiplist_t *skp) {
109108
}
110109
}
111110

112-
PANDAS_INLINE skiplist_t *skiplist_init(int expected_size) {
111+
static inline skiplist_t *skiplist_init(int expected_size) {
113112
skiplist_t *result;
114113
node_t *NIL, *head;
115114
int maxlevels, i;
@@ -147,7 +146,7 @@ PANDAS_INLINE skiplist_t *skiplist_init(int expected_size) {
147146
}
148147

149148
// 1 if left < right, 0 if left == right, -1 if left > right
150-
PANDAS_INLINE int _node_cmp(node_t *node, double value) {
149+
static inline int _node_cmp(node_t *node, double value) {
151150
if (node->is_nil || node->value > value) {
152151
return -1;
153152
} else if (node->value < value) {
@@ -157,7 +156,7 @@ PANDAS_INLINE int _node_cmp(node_t *node, double value) {
157156
}
158157
}
159158

160-
PANDAS_INLINE double skiplist_get(skiplist_t *skp, int i, int *ret) {
159+
static inline double skiplist_get(skiplist_t *skp, int i, int *ret) {
161160
node_t *node;
162161
int level;
163162

@@ -181,7 +180,7 @@ PANDAS_INLINE double skiplist_get(skiplist_t *skp, int i, int *ret) {
181180

182181
// Returns the lowest rank of all elements with value `value`, as opposed to the
183182
// highest rank returned by `skiplist_insert`.
184-
PANDAS_INLINE int skiplist_min_rank(skiplist_t *skp, double value) {
183+
static inline int skiplist_min_rank(skiplist_t *skp, double value) {
185184
node_t *node;
186185
int level, rank = 0;
187186

@@ -199,7 +198,7 @@ PANDAS_INLINE int skiplist_min_rank(skiplist_t *skp, double value) {
199198
// Returns the rank of the inserted element. When there are duplicates,
200199
// `rank` is the highest of the group, i.e. the 'max' method of
201200
// https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.rank.html
202-
PANDAS_INLINE int skiplist_insert(skiplist_t *skp, double value) {
201+
static inline int skiplist_insert(skiplist_t *skp, double value) {
203202
node_t *node, *prevnode, *newnode, *next_at_level;
204203
int *steps_at_level;
205204
int size, steps, level, rank = 0;
@@ -253,7 +252,7 @@ PANDAS_INLINE int skiplist_insert(skiplist_t *skp, double value) {
253252
return rank + 1;
254253
}
255254

256-
PANDAS_INLINE int skiplist_remove(skiplist_t *skp, double value) {
255+
static inline int skiplist_remove(skiplist_t *skp, double value) {
257256
int level, size;
258257
node_t *node, *prevnode, *tmpnode, *next_at_level;
259258
node_t **chain;

pandas/_libs/include/pandas/vendored/klib/khash.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ int main() {
8585

8686
#define AC_VERSION_KHASH_H "0.2.6"
8787

88-
#include "pandas/inline_helper.h"
8988
#include <limits.h>
9089
#include <stdlib.h>
9190
#include <string.h>
@@ -153,7 +152,7 @@ typedef khuint_t khiter_t;
153152

154153
// specializations of
155154
// https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp
156-
khuint32_t PANDAS_INLINE murmur2_32to32(khuint32_t k) {
155+
static inline khuint32_t murmur2_32to32(khuint32_t k) {
157156
const khuint32_t SEED = 0xc70f6907UL;
158157
// 'm' and 'r' are mixing constants generated offline.
159158
// They're not really 'magic', they just happen to work well.
@@ -186,7 +185,7 @@ khuint32_t PANDAS_INLINE murmur2_32to32(khuint32_t k) {
186185
// - no performance difference could be measured compared to a possible
187186
// x64-version
188187

189-
khuint32_t PANDAS_INLINE murmur2_32_32to32(khuint32_t k1, khuint32_t k2) {
188+
static inline khuint32_t murmur2_32_32to32(khuint32_t k1, khuint32_t k2) {
190189
const khuint32_t SEED = 0xc70f6907UL;
191190
// 'm' and 'r' are mixing constants generated offline.
192191
// They're not really 'magic', they just happen to work well.
@@ -220,7 +219,7 @@ khuint32_t PANDAS_INLINE murmur2_32_32to32(khuint32_t k1, khuint32_t k2) {
220219
return h;
221220
}
222221

223-
khuint32_t PANDAS_INLINE murmur2_64to32(khuint64_t k) {
222+
static inline khuint32_t murmur2_64to32(khuint64_t k) {
224223
khuint32_t k1 = (khuint32_t)k;
225224
khuint32_t k2 = (khuint32_t)(k >> 32);
226225

@@ -445,7 +444,7 @@ static const double __ac_HASH_UPPER = 0.77;
445444

446445
#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, \
447446
__hash_equal) \
448-
KHASH_INIT2(name, PANDAS_INLINE, khkey_t, khval_t, kh_is_map, __hash_func, \
447+
KHASH_INIT2(name, static inline, khkey_t, khval_t, kh_is_map, __hash_func, \
449448
__hash_equal)
450449

451450
/* --- BEGIN OF HASH FUNCTIONS --- */
@@ -465,7 +464,7 @@ static const double __ac_HASH_UPPER = 0.77;
465464
@param key The integer [khuint64_t]
466465
@return The hash value [khuint_t]
467466
*/
468-
PANDAS_INLINE khuint_t kh_int64_hash_func(khuint64_t key) {
467+
static inline khuint_t kh_int64_hash_func(khuint64_t key) {
469468
return (khuint_t)((key) >> 33 ^ (key) ^ (key) << 11);
470469
}
471470
/*! @function
@@ -478,7 +477,7 @@ PANDAS_INLINE khuint_t kh_int64_hash_func(khuint64_t key) {
478477
@param s Pointer to a null terminated string
479478
@return The hash value
480479
*/
481-
PANDAS_INLINE khuint_t __ac_X31_hash_string(const char *s) {
480+
static inline khuint_t __ac_X31_hash_string(const char *s) {
482481
khuint_t h = *s;
483482
if (h)
484483
for (++s; *s; ++s)
@@ -496,7 +495,7 @@ PANDAS_INLINE khuint_t __ac_X31_hash_string(const char *s) {
496495
*/
497496
#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0)
498497

499-
PANDAS_INLINE khuint_t __ac_Wang_hash(khuint_t key) {
498+
static inline khuint_t __ac_Wang_hash(khuint_t key) {
500499
key += ~(key << 15);
501500
key ^= (key >> 10);
502501
key += (key << 3);

0 commit comments

Comments
 (0)