Make private inlines in C files 'static inline', not just 'inline', or the compiler
can discard the definition if it chooses not to inline it.
Make functions declared in header files not be declared inline (if they're defined in a
.c file). It looks like no functions in this category are used in LibSRTP's critical
path, only for unit tests or generating AES tables.
To see the problem prior to this commit, compile with "gcc -O0 -std=gnu99".
Signed-off-by: Travis Cross <tc@traviscross.com>
This cherry-picks commit
e2774dbd551ffe5f872eaec2b2d40b712a54e1ba from
libsrtp upstream.
FS-6196 --resolve
* this is an internal, hopefully inlined function
*/
-inline void
+static inline void
aes_icm_advance_ismacryp(aes_icm_ctx_t *c, uint8_t forIsmacryp) {
/* fill buffer with new keystream */
v128_copy(&c->keystream_buffer, &c->counter);
}
}
-inline void aes_icm_advance(aes_icm_ctx_t *c) {
+static inline void aes_icm_advance(aes_icm_ctx_t *c) {
aes_icm_advance_ismacryp(c, 0);
}
return bit_string;
}
-inline int
+static inline int
hex_char_to_nibble(uint8_t c) {
switch(c) {
case ('0'): return 0x0;
/* gf2_8_shift() moved to gf2_8.h as an inline function */
-inline gf2_8
+gf2_8
gf2_8_multiply(gf2_8 x, gf2_8 y) {
gf2_8 z = 0;
return wt;
}
-inline unsigned char
+unsigned char
v32_distance(v32_t x, v32_t y) {
x.value ^= y.value;
return v32_weight(x);
return b;
}
-inline void
+void
v16_copy_octet_string(v16_t *x, const uint8_t s[2]) {
x->v8[0] = s[0];
x->v8[1] = s[1];
}
-inline void
+void
v32_copy_octet_string(v32_t *x, const uint8_t s[4]) {
x->v8[0] = s[0];
x->v8[1] = s[1];
x->v8[3] = s[3];
}
-inline void
+void
v64_copy_octet_string(v64_t *x, const uint8_t s[8]) {
x->v8[0] = s[0];
x->v8[1] = s[1];
#endif /* DATATYPES_USE_MACROS */
-inline void
+static inline void
v128_left_shift2(v128_t *x, int num_bits) {
int i;
int word_shift = num_bits >> 5;