]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
add new GCC-specific macro and force inlining of certain functions where speed is...
authorKevin P. Fleming <kpfleming@digium.com>
Tue, 1 Nov 2005 20:09:09 +0000 (20:09 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Tue, 1 Nov 2005 20:09:09 +0000 (20:09 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6929 65c4cc65-6c06-0410-ace0-fbb531ad65f3

ChangeLog
include/asterisk/compiler.h
include/asterisk/strings.h
include/asterisk/time.h
include/asterisk/utils.h

index e2dcf428b62727bbb52cdc486766d7b069ee4dbc..bb182b6730232236184b8d0694f7c3f153401479 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-11-01  Kevin P. Fleming  <kpfleming@digium.com>
+
+       * include/asterisk/utils.h (ast_slinear_saturated_add): force to be inlined whenever possible
+       (ast_slinear_saturated_multiply): same
+       (ast_slinear_saturated_divide): same
+       (inaddrcmp): same
+       * include/asterisk/strings.h (ast_strlen_zero): force to be inlined whenever possible
+       * include/asterisk/compiler.h (force_inline): add macro to force inlining of functions
+       
 2005-11-01  Kevin P. Fleming  <kpfleming@digium.com>
 
        * Asterisk 1.2.0-beta2 released.
index f436f4cb44451f46e5ee62a7c8e1e2bd7a26e862..62564c91cf5685ca34d2e0df3c62c014b80a1d94 100755 (executable)
 #define __builtin_expect(exp, c) (exp)
 #endif
 
+#ifdef __GNUC__
+#define force_inline inline __attribute__((always_inline))
+#else
+#define force_inline inline
+#endif
+
 #endif /* _ASTERISK_COMPILER_H */
index 370d4281c324f10396489d231564580e63419673..13ecb3a5f84f3e93b1dc0ed6e038bde67c13c14d 100755 (executable)
@@ -30,7 +30,7 @@
 #include "asterisk/compiler.h"
 #include "asterisk/compat.h"
 
-static inline int ast_strlen_zero(const char *s)
+static force_inline int ast_strlen_zero(const char *s)
 {
        return (!s || (*s == '\0'));
 }
index c957cb142223a1285bb0a594838be05f88ac7bf4..8132e9cd1f5907db69b6f79b797a39269240ce93 100755 (executable)
@@ -118,15 +118,6 @@ struct timeval ast_tvsub(struct timeval a, struct timeval b);
 /*!
  * \brief Returns a timeval from sec, usec
  */
-#if 0
-AST_INLINE_API(
-struct timeval ast_tv(int sec, int usec),
-{
-       struct timeval t = { sec, usec};
-       return t;
-}
-)
-#endif
 AST_INLINE_API(
 struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec),
 {
index 92a228aae870aa05b79bc4e940c427b3ed83c243..8eed095f0b4ae03f6ef33b74d094d6d6708b1683 100755 (executable)
@@ -138,14 +138,14 @@ struct ast_hostent {
        char buf[1024];
 };
 
-extern struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp);
+struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp);
 
 /* ast_md5_hash 
        \brief Produces MD5 hash based on input string */
-extern void ast_md5_hash(char *output, char *input);
+void ast_md5_hash(char *output, char *input);
 
-extern int ast_base64encode(char *dst, const unsigned char *src, int srclen, int max);
-extern int ast_base64decode(unsigned char *dst, const char *src, int max);
+int ast_base64encode(char *dst, const unsigned char *src, int srclen, int max);
+int ast_base64decode(unsigned char *dst, const char *src, int max);
 
 /*! ast_uri_encode
        \brief Turn text string to URI-encoded %XX version 
@@ -169,7 +169,7 @@ char *ast_uri_encode(char *string, char *outbuf, int buflen, int doreserved);
  */
 void ast_uri_decode(char *s);
 
-static inline void ast_slinear_saturated_add(short *input, short *value)
+static force_inline void ast_slinear_saturated_add(short *input, short *value)
 {
        int res;
 
@@ -182,7 +182,7 @@ static inline void ast_slinear_saturated_add(short *input, short *value)
                *input = (short) res;
 }
        
-static inline void ast_slinear_saturated_multiply(short *input, short *value)
+static force_inline void ast_slinear_saturated_multiply(short *input, short *value)
 {
        int res;
 
@@ -195,25 +195,25 @@ static inline void ast_slinear_saturated_multiply(short *input, short *value)
                *input = (short) res;
 }
 
-static inline void ast_slinear_saturated_divide(short *input, short *value)
+static force_inline void ast_slinear_saturated_divide(short *input, short *value)
 {
        *input /= *value;
 }
 
-extern int test_for_thread_safety(void);
+int test_for_thread_safety(void);
 
-extern const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia);
+const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia);
 
 #ifdef inet_ntoa
 #undef inet_ntoa
 #endif
 #define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
 
-extern int ast_utils_init(void);
-extern int ast_wait_for_input(int fd, int ms);
+int ast_utils_init(void);
+int ast_wait_for_input(int fd, int ms);
 
 /*! Compares the source address and port of two sockaddr_in */
-static inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
+static force_inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
 {
        return ((sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) 
                || (sin1->sin_port != sin2->sin_port));
@@ -221,7 +221,7 @@ static inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockadd
 
 #define AST_STACKSIZE 256 * 1024
 #define ast_pthread_create(a,b,c,d) ast_pthread_create_stack(a,b,c,d,0)
-extern int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data, size_t stacksize);
+int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data, size_t stacksize);
 
 /*!
        \brief Process a string to find and replace characters