barbieri pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=74d8148da3a91c0016033771595d81f10a73ccac
commit 74d8148da3a91c0016033771595d81f10a73ccac Author: Gustavo Sverzut Barbieri <barbi...@profusion.mobi> Date: Mon Dec 12 16:35:26 2016 -0200 efl_debug_common: remove stale code/macros. These are not needed anymore. --- src/bin/efl/efl_debug_common.c | 94 ------------------------------------------ src/bin/efl/efl_debug_common.h | 10 ----- 2 files changed, 104 deletions(-) diff --git a/src/bin/efl/efl_debug_common.c b/src/bin/efl/efl_debug_common.c index 7776d78..28e44c2 100644 --- a/src/bin/efl/efl_debug_common.c +++ b/src/bin/efl/efl_debug_common.c @@ -18,100 +18,6 @@ #include "efl_debug_common.h" -void -_protocol_collect(unsigned char **buf, unsigned int *buf_size, - void *data, int size) -{ - // no buffer yet - duplicate it as out only data - if (!*buf) - { - *buf = malloc(size); - if (*buf) - { - *buf_size = size; - memcpy(*buf, data, size); - } - } - // we have data - append to the buffer and reallocate it as needed - else - { - unsigned char *b = realloc(*buf, *buf_size + size); - if (b) - { - *buf = b; - memcpy(*buf + *buf_size, data, size); - *buf_size += size; - } - } -} - -int -_proto_read(unsigned char **buf, unsigned int *buf_size, - char *op, unsigned char **data) -{ - unsigned int size, new_buf_size; - unsigned char *b; - - // we have no data yet, or not enough - minimum 8 bytes - if (!*buf) return -1; - if (*buf_size < 8) return -1; - // get size of total message - memcpy(&size, *buf, 4); - // if size is invalid < 4 bytes - no message there - if (size < 4) return -1; - // if our total message buffer size is not big enough yet - no message - if (*buf_size < (size + 4)) return -1; - - // copy out 4 byte opcode and nul byet terminate it - memcpy(op, *buf + 4, 4); - op[4] = 0; - - // take off opcode header of 4 bytes - size -= 4; - // the new buffer size once we remove header+payload is... - new_buf_size = *buf_size - (size + 8); - if (size == 0) - { - *data = NULL; - size = 0; - } - else - { - // allocate new space for payload - *data = malloc(size); - if (!*data) - { - // allocation faild - no message - return -1; - } - memcpy(*data, *buf + 8, size); - } - // if new shrunk buffer size is empty -= just simply free buffer - if (new_buf_size == 0) - { - free(*buf); - *buf = NULL; - } - else - { - // allocate newly shrunk buffer - b = malloc(new_buf_size); - if (!b) - { - // alloc failure - bad. fail proto read then - free(*data); - return -1; - } - // copy data to new smaller buffer and free old, storing new buffer - memcpy(b, *buf + size + 8, new_buf_size); - free(*buf); - *buf = b; - } - // store new buffer size - *buf_size = new_buf_size; - return (int)size; -} - Eina_Bool received_data(Eo *sock, void (*handle)(void *data, const char op[static 4], const Eina_Slice payload), const void *data) { diff --git a/src/bin/efl/efl_debug_common.h b/src/bin/efl/efl_debug_common.h index b355210..6a0ba0b 100644 --- a/src/bin/efl/efl_debug_common.h +++ b/src/bin/efl/efl_debug_common.h @@ -35,16 +35,6 @@ typedef struct _Efl_Debug_Message_Header { char op[4]; } Efl_Debug_Message_Header; -void _protocol_collect(unsigned char **buf, unsigned int *buf_size, - void *data, int size); -int _proto_read(unsigned char **buf, unsigned int *buf_size, - char *op, unsigned char **data); - -#define fetch_val(dst, buf, off) \ - memcpy(&dst, ((unsigned char *)buf) + off, sizeof(dst)) -#define store_val(buf, off, src) \ - memcpy(buf + off, &src, sizeof(src)) - #define IS_OP(x) memcmp(op, OP_ ## x, 4) == 0 #define DECLARE_OP(x) static char OP_ ## x[4] = #x --