Skip to content

Commit

Permalink
Check for C99 before using inline. Fixes armon#5
Browse files Browse the repository at this point in the history
  • Loading branch information
armon committed Feb 27, 2014
1 parent 9b4866c commit 7a75bab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/art.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int destroy_art_tree(art_tree *t) {
/**
* Returns the size of the ART tree.
*/
extern inline uint64_t art_size(art_tree *t);
extern INLINE uint64_t art_size(art_tree *t);

static art_node** find_child(art_node *n, unsigned char c) {
int i, mask, bitfield;
Expand Down Expand Up @@ -180,7 +180,7 @@ static art_node** find_child(art_node *n, unsigned char c) {
}

// Simple inlined if
static inline int min(int a, int b) {
static INLINE int min(int a, int b) {
return (a < b) ? a : b;
}

Expand Down
8 changes: 7 additions & 1 deletion src/art.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#ifndef ART_H
#define ART_H

#if __STDC_VERSION__ >= 199901L
#define INLINE inline
#else
#define INLINE
#endif

#define NODE4 1
#define NODE16 2
#define NODE48 3
Expand Down Expand Up @@ -91,7 +97,7 @@ int destroy_art_tree(art_tree *t);
/**
* Returns the size of the ART tree.
*/
inline uint64_t art_size(art_tree *t) {
INLINE uint64_t art_size(art_tree *t) {
return t->size;
}

Expand Down

0 comments on commit 7a75bab

Please sign in to comment.