Skip to content

Commit

Permalink
Drop all dead functions
Browse files Browse the repository at this point in the history
These functions are never used anywhere:

- double xp_get_double(const char *name, const char *what, double defval)
- char* time_string(int ms)
- char* double_time_string(double ms)
- size_t decompress_if_needed(int sock, char* buff, size_t len, void** st)
  • Loading branch information
Simon Gomizelj committed Jul 16, 2015
1 parent 610ccc4 commit 231edd4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 91 deletions.
40 changes: 0 additions & 40 deletions src/scenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,6 @@ static double xp_get_double(const char *name, const char *what)
return val;
}

static double xp_get_double(const char *name, const char *what, double defval)
{
if (!(xp_get_value(name))) {
return defval;
}
return xp_get_double(name, what);
}

static long xp_get_long(const char *name, const char *what)
{
char *ptr;
Expand Down Expand Up @@ -454,21 +446,6 @@ bool get_bool(const char *ptr, const char *what)
}

/* Pretty print a time. */
static char* time_string(int ms)
{
static char tmp[20];

if (ms < 10000) {
snprintf(tmp, sizeof(tmp), "%dms", ms);
} else if (ms < 100000) {
snprintf(tmp, sizeof(tmp), "%.1fs", ((float)ms)/1000);
} else {
snprintf(tmp, sizeof(tmp), "%ds", ms/1000);
}

return tmp;
}

int time_string(double ms, char *res, int reslen)
{
if (ms < 10000) {
Expand Down Expand Up @@ -502,23 +479,6 @@ int time_string(double ms, char *res, int reslen)
}
}

static char* double_time_string(double ms)
{
static char tmp[20];

if (ms < 1000) {
snprintf(tmp, sizeof(tmp), "%.2lfms", ms);
} else if (ms < 10000) {
snprintf(tmp, sizeof(tmp), "%.1lfms", ms);
} else if (ms < 100000) {
snprintf(tmp, sizeof(tmp), "%.1lfs", ms / 1000);
} else {
snprintf(tmp, sizeof(tmp), "%ds", (int)(ms/1000));
}

return tmp;
}

/* For backwards compatibility, we assign "true" to slot 1, false to 0, and
* allow other valid integers. */
int scenario::get_rtd(const char *ptr, bool start)
Expand Down
51 changes: 0 additions & 51 deletions src/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,57 +1685,6 @@ void free_socketbuf(struct socketbuf *socketbuf)
free(socketbuf);
}

static size_t decompress_if_needed(int sock, char* buff, size_t len, void** st)
{
if (compression && len) {
if (useMessagef == 1) {
struct timeval currentTime;
GET_TIME (&currentTime);
TRACE_MSG("----------------------------------------------- %s\n"
"Compressed message received, header :\n"
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
CStat::formatTime(&currentTime, true),
buff[0] , buff[1] , buff[2] , buff[3],
buff[4] , buff[5] , buff[6] , buff[7],
buff[8] , buff[9] , buff[10], buff[11],
buff[12], buff[13], buff[14], buff[15]);
}

int rc = comp_uncompress(st,
buff,
(unsigned int *) &len);

switch(rc) {
case COMP_OK:
TRACE_MSG("Compressed message decompressed properly.\n");
break;

case COMP_REPLY:
TRACE_MSG("Compressed message KO, sending a reply (resynch).\n");
sendto(sock,
buff,
len,
0,
(sockaddr *)(void *)&remote_sockaddr,
SOCK_ADDR_SIZE(&remote_sockaddr));
resynch_send++;
return 0;

case COMP_DISCARD:
TRACE_MSG("Compressed message discarded by plugin.\n");
resynch_recv++;
return 0;

default:
case COMP_KO:
ERROR("Compression plugin error");
return 0;
}
}
return len;
}

#ifdef USE_SCTP
void sipp_sctp_peer_params(struct sipp_socket *socket)
{
Expand Down

0 comments on commit 231edd4

Please sign in to comment.