Skip to content

Commit

Permalink
remove stack trace stuff from lib
Browse files Browse the repository at this point in the history
  • Loading branch information
256dpi committed Sep 29, 2015
1 parent 9988526 commit e1200d3
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 119 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ set(SOURCE_FILES
src/lib/MQTTConnect.h
src/lib/MQTTConnectClient.c
src/lib/MQTTDeserializePublish.c
src/lib/MQTTLogging.h
src/lib/MQTTPacket.c
src/lib/MQTTPacket.h
src/lib/MQTTPublish.h
Expand All @@ -23,7 +22,6 @@ set(SOURCE_FILES
src/lib/MQTTSubscribeClient.c
src/lib/MQTTUnsubscribe.h
src/lib/MQTTUnsubscribeClient.c
src/lib/StackTrace.h
src/MQTTClient.cpp
src/MQTTClient.h
src/Network.cpp
Expand Down
10 changes: 1 addition & 9 deletions src/lib/MQTTConnectClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*******************************************************************************/

#include "MQTTPacket.h"
#include "StackTrace.h"

#include <string.h>

Expand All @@ -28,7 +27,6 @@ int MQTTSerialize_connectLength(MQTTPacket_connectData* options)
{
int len = 0;

FUNC_ENTRY;

if (options->MQTTVersion == 3)
len = 12; /* variable depending on MQTT or MQIsdp */
Expand All @@ -43,7 +41,6 @@ int MQTTSerialize_connectLength(MQTTPacket_connectData* options)
if (options->password.cstring || options->password.lenstring.data)
len += MQTTstrlen(options->password)+2;

FUNC_EXIT_RC(len);
return len;
}

Expand All @@ -63,7 +60,6 @@ int MQTTSerialize_connect(unsigned char* buf, int buflen, MQTTPacket_connectData
int len = 0;
int rc = -1;

FUNC_ENTRY;
if (MQTTPacket_len(len = MQTTSerialize_connectLength(options)) > buflen)
{
rc = MQTTPACKET_BUFFER_TOO_SHORT;
Expand Down Expand Up @@ -116,7 +112,7 @@ int MQTTSerialize_connect(unsigned char* buf, int buflen, MQTTPacket_connectData

rc = ptr - buf;

exit: FUNC_EXIT_RC(rc);
exit:
return rc;
}

Expand All @@ -138,7 +134,6 @@ int MQTTDeserialize_connack(unsigned char* sessionPresent, unsigned char* connac
int mylen;
MQTTConnackFlags flags = {0};

FUNC_ENTRY;
header.byte = readChar(&curdata);
if (header.bits.type != CONNACK)
goto exit;
Expand All @@ -154,7 +149,6 @@ int MQTTDeserialize_connack(unsigned char* sessionPresent, unsigned char* connac

rc = 1;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand All @@ -172,7 +166,6 @@ int MQTTSerialize_zero(unsigned char* buf, int buflen, unsigned char packettype)
int rc = -1;
unsigned char *ptr = buf;

FUNC_ENTRY;
if (buflen < 2)
{
rc = MQTTPACKET_BUFFER_TOO_SHORT;
Expand All @@ -185,7 +178,6 @@ int MQTTSerialize_zero(unsigned char* buf, int buflen, unsigned char packettype)
ptr += MQTTPacket_encode(ptr, 0); /* write remaining length */
rc = ptr - buf;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand Down
5 changes: 0 additions & 5 deletions src/lib/MQTTDeserializePublish.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************/

#include "StackTrace.h"
#include "MQTTPacket.h"
#include <string.h>

Expand Down Expand Up @@ -42,7 +41,6 @@ int MQTTDeserialize_publish(unsigned char* dup, int* qos, unsigned char* retaine
int rc = 0;
int mylen = 0;

FUNC_ENTRY;
header.byte = readChar(&curdata);
if (header.bits.type != PUBLISH)
goto exit;
Expand All @@ -64,7 +62,6 @@ int MQTTDeserialize_publish(unsigned char* dup, int* qos, unsigned char* retaine
*payload = curdata;
rc = 1;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand All @@ -87,7 +84,6 @@ int MQTTDeserialize_ack(unsigned char* packettype, unsigned char* dup, unsigned
int rc = 0;
int mylen;

FUNC_ENTRY;
header.byte = readChar(&curdata);
*dup = header.bits.dup;
*packettype = header.bits.type;
Expand All @@ -101,7 +97,6 @@ int MQTTDeserialize_ack(unsigned char* packettype, unsigned char* dup, unsigned

rc = 1;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

9 changes: 0 additions & 9 deletions src/lib/MQTTPacket.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* Sergio R. Caprile - non-blocking packet read functions for stream transport
*******************************************************************************/

#include "StackTrace.h"
#include "MQTTPacket.h"

#include <string.h>
Expand All @@ -30,7 +29,6 @@ int MQTTPacket_encode(unsigned char* buf, int length)
{
int rc = 0;

FUNC_ENTRY;
do
{
char d = length % 128;
Expand All @@ -40,7 +38,6 @@ int MQTTPacket_encode(unsigned char* buf, int length)
d |= 0x80;
buf[rc++] = d;
} while (length > 0);
FUNC_EXIT_RC(rc);
return rc;
}

Expand All @@ -58,7 +55,6 @@ int MQTTPacket_decode(int (*getcharfn)(unsigned char*, int), int* value)
int len = 0;
#define MAX_NO_OF_REMAINING_LENGTH_BYTES 4

FUNC_ENTRY;
*value = 0;
do
{
Expand All @@ -76,7 +72,6 @@ int MQTTPacket_decode(int (*getcharfn)(unsigned char*, int), int* value)
multiplier *= 128;
} while ((c & 128) != 0);
exit:
FUNC_EXIT_RC(len);
return len;
}

Expand Down Expand Up @@ -216,7 +211,6 @@ int readMQTTLenString(MQTTString* mqttstring, unsigned char** pptr, unsigned cha
{
int rc = 0;

FUNC_ENTRY;
/* the first two bytes are the length of the string */
if (enddata - (*pptr) > 1) /* enough length to read the integer? */
{
Expand All @@ -229,7 +223,6 @@ int readMQTTLenString(MQTTString* mqttstring, unsigned char** pptr, unsigned cha
}
}
mqttstring->cstring = NULL;
FUNC_EXIT_RC(rc);
return rc;
}

Expand Down Expand Up @@ -326,7 +319,6 @@ static int MQTTPacket_decodenb(MQTTTransport *trp)
unsigned char c;
int rc = MQTTPACKET_READ_ERROR;

FUNC_ENTRY;
if(trp->len == 0){ /* initialize on first call */
trp->multiplier = 1;
trp->rem_len = 0;
Expand All @@ -346,7 +338,6 @@ static int MQTTPacket_decodenb(MQTTTransport *trp)
} while ((c & 128) != 0);
rc = trp->len;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand Down
5 changes: 0 additions & 5 deletions src/lib/MQTTSerializePublish.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*******************************************************************************/

#include "MQTTPacket.h"
#include "StackTrace.h"

#include <string.h>

Expand Down Expand Up @@ -60,7 +59,6 @@ int MQTTSerialize_publish(unsigned char* buf, int buflen, unsigned char dup, int
int rem_len = 0;
int rc = 0;

FUNC_ENTRY;
if (MQTTPacket_len(rem_len = MQTTSerialize_publishLength(qos, topicName, payloadlen)) > buflen)
{
rc = MQTTPACKET_BUFFER_TOO_SHORT;
Expand All @@ -86,7 +84,6 @@ int MQTTSerialize_publish(unsigned char* buf, int buflen, unsigned char dup, int
rc = ptr - buf;

exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand All @@ -107,7 +104,6 @@ int MQTTSerialize_ack(unsigned char* buf, int buflen, unsigned char packettype,
int rc = 0;
unsigned char *ptr = buf;

FUNC_ENTRY;
if (buflen < 4)
{
rc = MQTTPACKET_BUFFER_TOO_SHORT;
Expand All @@ -122,7 +118,6 @@ int MQTTSerialize_ack(unsigned char* buf, int buflen, unsigned char packettype,
writeInt(&ptr, packetid);
rc = ptr - buf;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand Down
5 changes: 0 additions & 5 deletions src/lib/MQTTSubscribeClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*******************************************************************************/

#include "MQTTPacket.h"
#include "StackTrace.h"

#include <string.h>

Expand Down Expand Up @@ -56,7 +55,6 @@ int MQTTSerialize_subscribe(unsigned char* buf, int buflen, unsigned char dup, u
int rc = 0;
int i = 0;

FUNC_ENTRY;
if (MQTTPacket_len(rem_len = MQTTSerialize_subscribeLength(count, topicFilters)) > buflen)
{
rc = MQTTPACKET_BUFFER_TOO_SHORT;
Expand All @@ -81,7 +79,6 @@ int MQTTSerialize_subscribe(unsigned char* buf, int buflen, unsigned char dup, u

rc = ptr - buf;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand All @@ -105,7 +102,6 @@ int MQTTDeserialize_suback(unsigned short* packetid, int maxcount, int* count, i
int rc = 0;
int mylen;

FUNC_ENTRY;
header.byte = readChar(&curdata);
if (header.bits.type != SUBACK)
goto exit;
Expand All @@ -130,7 +126,6 @@ int MQTTDeserialize_suback(unsigned short* packetid, int maxcount, int* count, i

rc = 1;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand Down
5 changes: 0 additions & 5 deletions src/lib/MQTTUnsubscribeClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*******************************************************************************/

#include "MQTTPacket.h"
#include "StackTrace.h"

#include <string.h>

Expand Down Expand Up @@ -55,7 +54,6 @@ int MQTTSerialize_unsubscribe(unsigned char* buf, int buflen, unsigned char dup,
int rc = -1;
int i = 0;

FUNC_ENTRY;
if (MQTTPacket_len(rem_len = MQTTSerialize_unsubscribeLength(count, topicFilters)) > buflen)
{
rc = MQTTPACKET_BUFFER_TOO_SHORT;
Expand All @@ -77,7 +75,6 @@ int MQTTSerialize_unsubscribe(unsigned char* buf, int buflen, unsigned char dup,

rc = ptr - buf;
exit:
FUNC_EXIT_RC(rc);
return rc;
}

Expand All @@ -95,11 +92,9 @@ int MQTTDeserialize_unsuback(unsigned short* packetid, unsigned char* buf, int b
unsigned char dup = 0;
int rc = 0;

FUNC_ENTRY;
rc = MQTTDeserialize_ack(&type, &dup, packetid, buf, buflen);
if (type == UNSUBACK)
rc = 1;
FUNC_EXIT_RC(rc);
return rc;
}

Expand Down
78 changes: 0 additions & 78 deletions src/lib/StackTrace.h

This file was deleted.

Loading

0 comments on commit e1200d3

Please sign in to comment.