Skip to content

Commit

Permalink
merge patch of issue #257
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli authored and jason-mao committed Oct 30, 2019
1 parent 5c8b426 commit ce27844
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 修改文档中的错误(感谢俊杰提供补丁)。
* 更新awtk config sample。
* 修改软键盘弹出时出现屏保的问题。
* 完善new.cpp/new.hpp (感谢陈谭提供补丁)。

* 2019/10/23
* 修改clone出来的edit的显示问题。
Expand Down
4 changes: 2 additions & 2 deletions src/misc/new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

#ifndef HAS_STD_MALLOC

void* operator new(std::size_t size) throw(std::bad_alloc) {
void* operator new(std::size_t size) __TK_THROW_BAD_ALLOC {
if (size >= MAX_SIZE) {
log_debug("size is too large\n");
}

return TKMEM_ALLOC(size);
}

void* operator new[](std::size_t size) throw(std::bad_alloc) {
void* operator new[](std::size_t size) __TK_THROW_BAD_ALLOC {
if (size >= MAX_SIZE) {
log_debug("size is too large\n");
}
Expand Down
10 changes: 8 additions & 2 deletions src/misc/new.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@

#ifndef HAS_STD_MALLOC

void* operator new(std::size_t size) throw(std::bad_alloc);
#if __cplusplus < 201103L || defined(__ARMCC_VERSION)
#define __TK_THROW_BAD_ALLOC throw(std::bad_alloc)
#else
#define __TK_THROW_BAD_ALLOC
#endif

void* operator new[](std::size_t size) throw(std::bad_alloc);
void* operator new(std::size_t size) __TK_THROW_BAD_ALLOC;

void* operator new[](std::size_t size) __TK_THROW_BAD_ALLOC;

void operator delete(void* obj) throw();

Expand Down

0 comments on commit ce27844

Please sign in to comment.