diff options
author | Jim Huang <jserv@0xlab.org> | 2011-12-12 16:31:51 +0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2013-07-24 13:12:58 -0700 |
commit | e74dd8bfad25af72d07cc3a33165d3c464b6d2bd (patch) | |
tree | 695d732f57d44b681d37d10b9ac8f61111d41c26 /libc/include/resolv.h | |
parent | d146e8e4e922aa272aa4c088fd6122836c8f45ca (diff) | |
download | bionic-e74dd8bfad25af72d07cc3a33165d3c464b6d2bd.zip bionic-e74dd8bfad25af72d07cc3a33165d3c464b6d2bd.tar.gz bionic-e74dd8bfad25af72d07cc3a33165d3c464b6d2bd.tar.bz2 |
Use GCC's __attribute__((const)) to reduce code size
__attribute__((const)) is mainly intended for the compiler to optimize
away repeated calls to a function that the compiler knows will return
the same value repeatedly.
By adding __attribute__((const)), the compiler can choose to call the
function just once and cache the return value. Therefore, this yields
code size reduction.
Here are the reference results by arm-eabi-size for crespo device:
[before]
text data bss dec hex filename
267715 10132 45948 323795 4f0d3
[after]
text data bss dec hex filename
267387 10132 45948 323467 4ef8b
Change-Id: I1d80465c0f88158449702d4dc6398a130eb77195
Diffstat (limited to 'libc/include/resolv.h')
-rw-r--r-- | libc/include/resolv.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/include/resolv.h b/libc/include/resolv.h index 7c34012..221410d 100644 --- a/libc/include/resolv.h +++ b/libc/include/resolv.h @@ -40,7 +40,7 @@ __BEGIN_DECLS struct res_state; -extern struct __res_state *__res_state(void); +extern struct __res_state *__res_state(void) __attribute__((const)); #define _res (*__res_state()) /* Base-64 functions - because some code expects it there */ |