Fix inline functions when compiling as C99.
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 commit is contained in:
parent
d1e40b088a
commit
50791508b1
|
@ -284,7 +284,7 @@ aes_icm_set_iv(aes_icm_ctx_t *c, void *iv) {
|
|||
* 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);
|
||||
|
@ -309,7 +309,7 @@ aes_icm_advance_ismacryp(aes_icm_ctx_t *c, uint8_t forIsmacryp) {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ octet_string_hex_string(const void *s, int length) {
|
|||
return bit_string;
|
||||
}
|
||||
|
||||
inline int
|
||||
static inline int
|
||||
hex_char_to_nibble(uint8_t c) {
|
||||
switch(c) {
|
||||
case ('0'): return 0x0;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ v32_weight(v32_t a) {
|
|||
return wt;
|
||||
}
|
||||
|
||||
inline unsigned char
|
||||
unsigned char
|
||||
v32_distance(v32_t x, v32_t y) {
|
||||
x.value ^= y.value;
|
||||
return v32_weight(x);
|
||||
|
@ -524,13 +524,13 @@ A_times_x_plus_b(uint8_t A[8], uint8_t x, uint8_t b) {
|
|||
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];
|
||||
|
@ -538,7 +538,7 @@ v32_copy_octet_string(v32_t *x, const uint8_t s[4]) {
|
|||
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];
|
||||
|
@ -632,7 +632,7 @@ v128_set_bit_to(v128_t *x, int i, int y){
|
|||
#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;
|
||||
|
|
Loading…
Reference in New Issue