Commit e9bfdeb2 authored by eric's avatar eric

improve the readability of code

parent 45938762
...@@ -222,7 +222,7 @@ public: ...@@ -222,7 +222,7 @@ public:
inline T* get_object() { inline T* get_object() {
LocalPool* lp = get_or_new_local_pool(); LocalPool* lp = get_or_new_local_pool();
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp->get(); return lp->get();
} }
return NULL; return NULL;
...@@ -231,7 +231,7 @@ public: ...@@ -231,7 +231,7 @@ public:
template <typename A1> template <typename A1>
inline T* get_object(const A1& arg1) { inline T* get_object(const A1& arg1) {
LocalPool* lp = get_or_new_local_pool(); LocalPool* lp = get_or_new_local_pool();
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp->get(arg1); return lp->get(arg1);
} }
return NULL; return NULL;
...@@ -240,7 +240,7 @@ public: ...@@ -240,7 +240,7 @@ public:
template <typename A1, typename A2> template <typename A1, typename A2>
inline T* get_object(const A1& arg1, const A2& arg2) { inline T* get_object(const A1& arg1, const A2& arg2) {
LocalPool* lp = get_or_new_local_pool(); LocalPool* lp = get_or_new_local_pool();
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp->get(arg1, arg2); return lp->get(arg1, arg2);
} }
return NULL; return NULL;
...@@ -248,7 +248,7 @@ public: ...@@ -248,7 +248,7 @@ public:
inline int return_object(T* ptr) { inline int return_object(T* ptr) {
LocalPool* lp = get_or_new_local_pool(); LocalPool* lp = get_or_new_local_pool();
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp->return_object(ptr); return lp->return_object(ptr);
} }
return -1; return -1;
...@@ -378,7 +378,7 @@ private: ...@@ -378,7 +378,7 @@ private:
inline LocalPool* get_or_new_local_pool() { inline LocalPool* get_or_new_local_pool() {
LocalPool* lp = _local_pool; LocalPool* lp = _local_pool;
if (__builtin_expect(lp != NULL, 1)) { if (BAIDU_LIKELY(lp != NULL)) {
return lp; return lp;
} }
lp = new(std::nothrow) LocalPool(this); lp = new(std::nothrow) LocalPool(this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment