This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new a91751d Cleanup: Remove unused AllocType and unused functions
a91751d is described below
commit a91751d9153e490fd7da84a055fb693895e42141
Author: Masaori Koshiba <[email protected]>
AuthorDate: Fri Aug 30 09:52:22 2019 +0900
Cleanup: Remove unused AllocType and unused functions
(cherry picked from commit c65f0a1fbe4838cf56ba422f0a197895bf3c498e)
---
iocore/eventsystem/I_IOBuffer.h | 42 +++++---------------------------------
iocore/eventsystem/P_IOBuffer.h | 45 -----------------------------------------
2 files changed, 5 insertions(+), 82 deletions(-)
diff --git a/iocore/eventsystem/I_IOBuffer.h b/iocore/eventsystem/I_IOBuffer.h
index 9a85c63..4390bb1 100644
--- a/iocore/eventsystem/I_IOBuffer.h
+++ b/iocore/eventsystem/I_IOBuffer.h
@@ -62,11 +62,8 @@ extern int64_t default_large_iobuffer_size; // matched to
size of OS buffers
enum AllocType {
NO_ALLOC,
- FAST_ALLOCATED,
- XMALLOCED,
MEMALIGNED,
DEFAULT_ALLOC,
- CONSTANT,
};
#define DEFAULT_BUFFER_NUMBER 128
@@ -144,14 +141,6 @@ void init_buffer_allocators(int iobuffer_advice);
<td></td>
</tr>
<tr>
- <td>FAST_ALLOCATED</td>
- <td></td>
- </tr>
- <tr>
- <td>XMALLOCED</td>
- <td></td>
- </tr>
- <tr>
<td>MEMALIGNED</td>
<td></td>
</tr>
@@ -159,10 +148,6 @@ void init_buffer_allocators(int iobuffer_advice);
<td>DEFAULT_ALLOC</td>
<td></td>
</tr>
- <tr>
- <td>CONSTANT</td>
- <td></td>
- </tr>
</table>
*/
@@ -465,8 +450,6 @@ public:
void realloc_set_internal(void *b, int64_t buf_size, int64_t asize_index);
void realloc(void *b, int64_t buf_size);
void realloc(int64_t i);
- void realloc_xmalloc(void *b, int64_t buf_size);
- void realloc_xmalloc(int64_t buf_size);
/**
Frees the IOBufferBlock object and its underlying memory.
@@ -956,6 +939,10 @@ public:
void add_block();
/**
+ Deprecated
+
+ TODO: remove this function. Because ats_xmalloc() doesn't exist anymore.
+
Adds by reference len bytes of data pointed to by b to the end
of the buffer. b MUST be a pointer to the beginning of block
allocated from the ats_xmalloc() routine. The data will be deallocated
@@ -1185,9 +1172,7 @@ public:
void dealloc_all_readers();
void set(void *b, int64_t len);
- void set_xmalloced(void *b, int64_t len);
void alloc(int64_t i = default_large_iobuffer_size);
- void alloc_xmalloc(int64_t buf_size);
void append_block_internal(IOBufferBlock *b);
int64_t write(IOBufferBlock const *b, int64_t len, int64_t offset);
int64_t puts(char *buf, int64_t len);
@@ -1254,16 +1239,6 @@ public:
{
_writer->realloc(b, buf_size);
}
- void
- realloc_xmalloc(void *b, int64_t buf_size)
- {
- _writer->realloc_xmalloc(b, buf_size);
- }
- void
- realloc_xmalloc(int64_t buf_size)
- {
- _writer->realloc_xmalloc(buf_size);
- }
int64_t size_index;
@@ -1453,12 +1428,6 @@ extern IOBufferData *new_xmalloc_IOBufferData_internal(
#endif
void *b, int64_t size);
-extern IOBufferData *new_constant_IOBufferData_internal(
-#ifdef TRACK_BUFFER_USER
- const char *locaction,
-#endif
- void *b, int64_t size);
-
#ifdef TRACK_BUFFER_USER
class IOBufferData_tracker
{
@@ -1474,14 +1443,13 @@ public:
};
#endif
+// TODO: remove new_xmalloc_IOBufferData. Because ats_xmalloc() doesn't exist
anymore.
#ifdef TRACK_BUFFER_USER
#define new_IOBufferData IOBufferData_tracker(RES_PATH("memory/IOBuffer/"))
#define new_xmalloc_IOBufferData(b, size)
new_xmalloc_IOBufferData_internal(RES_PATH("memory/IOBuffer/"), (b), (size))
-#define new_constant_IOBufferData(b, size)
new_constant_IOBufferData_internal(RES_PATH("memory/IOBuffer/"), (b), (size))
#else
#define new_IOBufferData new_IOBufferData_internal
#define new_xmalloc_IOBufferData new_xmalloc_IOBufferData_internal
-#define new_constant_IOBufferData new_constant_IOBufferData_internal
#endif
extern int64_t iobuffer_size_to_index(int64_t size, int64_t max =
max_iobuffer_size);
diff --git a/iocore/eventsystem/P_IOBuffer.h b/iocore/eventsystem/P_IOBuffer.h
index 7252f48..49e6555 100644
--- a/iocore/eventsystem/P_IOBuffer.h
+++ b/iocore/eventsystem/P_IOBuffer.h
@@ -217,20 +217,6 @@ new_IOBufferData_internal(
}
TS_INLINE IOBufferData *
-new_constant_IOBufferData_internal(
-#ifdef TRACK_BUFFER_USER
- const char *loc,
-#endif
- void *b, int64_t size)
-{
- return new_IOBufferData_internal(
-#ifdef TRACK_BUFFER_USER
- loc,
-#endif
- b, size, BUFFER_SIZE_INDEX_FOR_CONSTANT_SIZE(size));
-}
-
-TS_INLINE IOBufferData *
new_xmalloc_IOBufferData_internal(
#ifdef TRACK_BUFFER_USER
const char *location,
@@ -519,18 +505,6 @@ IOBufferBlock::realloc(void *b, int64_t buf_size)
}
TS_INLINE void
-IOBufferBlock::realloc_xmalloc(void *b, int64_t buf_size)
-{
- realloc_set_internal(b, buf_size, -buf_size);
-}
-
-TS_INLINE void
-IOBufferBlock::realloc_xmalloc(int64_t buf_size)
-{
- realloc_set_internal(ats_malloc(buf_size), buf_size, -buf_size);
-}
-
-TS_INLINE void
IOBufferBlock::realloc(int64_t i)
{
if ((i == data->_size_index) || (i >= (int64_t)countof(ioBufAllocator))) {
@@ -1107,18 +1081,6 @@ MIOBuffer::set(void *b, int64_t len)
}
TS_INLINE void
-MIOBuffer::set_xmalloced(void *b, int64_t len)
-{
-#ifdef TRACK_BUFFER_USER
- _writer = new_IOBufferBlock_internal(_location);
-#else
- _writer = new_IOBufferBlock_internal();
-#endif
- _writer->set_internal(b, len, BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(len));
- init_readers();
-}
-
-TS_INLINE void
MIOBuffer::append_xmalloced(void *b, int64_t len)
{
#ifdef TRACK_BUFFER_USER
@@ -1156,13 +1118,6 @@ MIOBuffer::alloc(int64_t i)
}
TS_INLINE void
-MIOBuffer::alloc_xmalloc(int64_t buf_size)
-{
- char *b = (char *)ats_malloc(buf_size);
- set_xmalloced(b, buf_size);
-}
-
-TS_INLINE void
MIOBuffer::dealloc_reader(IOBufferReader *e)
{
if (e->accessor) {