summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-12 16:35:26 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-19 09:52:30 -0200
commit74d8148da3a91c0016033771595d81f10a73ccac (patch)
tree7e699e5fe77c7e373c85a670877ad4453f09c38a
parent72f98a06499cbabc7f56290afa89f7b8b37f52b9 (diff)
downloadefl-74d8148da3a91c0016033771595d81f10a73ccac.tar.gz
efl_debug_common: remove stale code/macros.
These are not needed anymore.
-rw-r--r--src/bin/efl/efl_debug_common.c94
-rw-r--r--src/bin/efl/efl_debug_common.h10
2 files changed, 0 insertions, 104 deletions
diff --git a/src/bin/efl/efl_debug_common.c b/src/bin/efl/efl_debug_common.c
index 7776d78816..28e44c2497 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 b355210906..6a0ba0b416 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