]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fix inline functions when compiling as C99.
authorJonathan Lennox <jonathan@vidyo.com>
Thu, 27 Oct 2011 16:06:12 +0000 (16:06 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 9 Feb 2014 22:34:05 +0000 (22:34 +0000)
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

libs/srtp/crypto/cipher/aes_icm.c
libs/srtp/crypto/math/datatypes.c
libs/srtp/crypto/math/gf2_8.c
libs/srtp/crypto/math/math.c

index 152e4c93b70f758d1f384d2c6483ec7ad0e76e19..354ad1656d5d15d2e4c06879b7fd930f938cc5df 100644 (file)
@@ -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);
 }
 
index 58c7502176dad0d36241502d5a39d8afa8ab9a32..2bd8c3429f9fe37e07040c58413a97096dc32ec0 100644 (file)
@@ -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;
index 7bd5a0dea2804d102f884e711c68396ab26fa199..fe6e4790fc3ee51330bfe84d0ad43353f5ba62ab 100644 (file)
@@ -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;
 
index 0d4757792d04c082fec9201e0a9b662e5bf4f24c..c2f2d5b6076754db8c71b0ce5017c804ba49f858 100644 (file)
@@ -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;