Commit b9502cd90c2b0456835938ecde9068707658247f

Authored by Georg Hopp
1 parent 9b18e8b2

Inline simple accessor functions

... ... @@ -34,8 +34,21 @@ TR_INTERFACE(TR_Hashable) {
34 34 fptr_TR_hashableHandleDouble handleDouble;
35 35 };
36 36
37   -extern unsigned long TR_hashableGetHash(void *);
38   -extern void TR_hashableHandleDouble(void *, void *);
  37 +inline
  38 +unsigned long
  39 +TR_hashableGetHash(void * hashable)
  40 +{
  41 + unsigned long ret;
  42 + TR_RETCALL(hashable, TR_Hashable, getHash, ret);
  43 + return ret;
  44 +}
  45 +
  46 +inline
  47 +void
  48 +TR_hashableHandleDouble(void * hashable, void * new_hashable)
  49 +{
  50 + TR_CALL(hashable, TR_Hashable, handleDouble, new_hashable);
  51 +}
39 52
40 53 #endif // __TR_INTERFACE_HASHABLE_H__
41 54
... ...
... ... @@ -42,10 +42,37 @@ TR_INTERFACE(TR_Iterable) {
42 42 TR_iterableRewind((this)); \
43 43 for (; TR_iterableValid((this)); TR_iterableNext((this)))
44 44
45   -extern void * TR_iterableCurrent(void *);
46   -extern void TR_iterableNext(void *);
47   -extern void TR_iterableRewind(void *);
48   -extern int TR_iterableValid(void *);
  45 +inline
  46 +void *
  47 +TR_iterableCurrent(void * iterable)
  48 +{
  49 + void * ret;
  50 + TR_RETCALL(iterable, TR_Iterable, current, ret);
  51 + return ret;
  52 +}
  53 +
  54 +inline
  55 +void
  56 +TR_iterableNext(void * iterable)
  57 +{
  58 + TR_CALL(iterable, TR_Iterable, next);
  59 +}
  60 +
  61 +inline
  62 +void
  63 +TR_iterableRewind(void * iterable)
  64 +{
  65 + TR_CALL(iterable, TR_Iterable, rewind);
  66 +}
  67 +
  68 +inline
  69 +int
  70 +TR_iterableValid(void * iterable)
  71 +{
  72 + int ret;
  73 + TR_RETCALL(iterable, TR_Iterable, valid, ret);
  74 + return ret;
  75 +}
49 76
50 77 #endif // __TR_INTERFACE_ITERABLE_H__
51 78
... ...
... ... @@ -29,20 +29,7 @@
29 29
30 30 TR_CREATE_INTERFACE(TR_Hashable, 2);
31 31
32   -unsigned long
33   -TR_hashableGetHash(void * hashable)
34   -{
35   - unsigned long ret;
36   -
37   - TR_RETCALL(hashable, TR_Hashable, getHash, ret);
38   -
39   - return ret;
40   -}
41   -
42   -void
43   -TR_hashableHandleDouble(void * hashable, void * new_hashable)
44   -{
45   - TR_CALL(hashable, TR_Hashable, handleDouble, new_hashable);
46   -}
  32 +extern inline unsigned long TR_hashableGetHash(void *);
  33 +extern inline void TR_hashableHandleDouble(void *, void *);
47 34
48 35 // vim: set ts=4 sw=4:
... ...
... ... @@ -25,32 +25,9 @@
25 25
26 26 TR_CREATE_INTERFACE(TR_Iterable, 4);
27 27
28   -void *
29   -TR_iterableCurrent(void * iterable)
30   -{
31   - void * ret;
32   - TR_RETCALL(iterable, TR_Iterable, current, ret);
33   - return ret;
34   -}
35   -
36   -void
37   -TR_iterableNext(void * iterable)
38   -{
39   - TR_CALL(iterable, TR_Iterable, next);
40   -}
41   -
42   -void
43   -TR_iterableRewind(void * iterable)
44   -{
45   - TR_CALL(iterable, TR_Iterable, rewind);
46   -}
47   -
48   -int
49   -TR_iterableValid(void * iterable)
50   -{
51   - int ret;
52   - TR_RETCALL(iterable, TR_Iterable, valid, ret);
53   - return ret;
54   -}
  28 +extern inline void * TR_iterableCurrent(void *);
  29 +extern inline void TR_iterableNext(void *);
  30 +extern inline void TR_iterableRewind(void *);
  31 +extern inline int TR_iterableValid(void *);
55 32
56 33 // vim: set ts=4 sw=4:
... ...
Please register or login to post a comment