Make use of shared stream api
Remove own componized realloc and reset code to shared stream api implementation.
This commit is contained in:
parent
4cbfda90fd
commit
fc6ce03875
35
tcp.c
35
tcp.c
@ -101,16 +101,9 @@ tcp_init(uint32 maxlen)
|
|||||||
scard_lock(SCARD_LOCK_TCP);
|
scard_lock(SCARD_LOCK_TCP);
|
||||||
#endif
|
#endif
|
||||||
result = &g_out[cur_stream_id];
|
result = &g_out[cur_stream_id];
|
||||||
|
s_realloc(result, maxlen);
|
||||||
|
s_reset(result);
|
||||||
cur_stream_id = (cur_stream_id + 1) % STREAM_COUNT;
|
cur_stream_id = (cur_stream_id + 1) % STREAM_COUNT;
|
||||||
|
|
||||||
if (maxlen > result->size)
|
|
||||||
{
|
|
||||||
result->data = (uint8 *) xrealloc(result->data, maxlen);
|
|
||||||
result->size = maxlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
result->p = result->data;
|
|
||||||
result->end = result->data + result->size;
|
|
||||||
#ifdef WITH_SCARD
|
#ifdef WITH_SCARD
|
||||||
scard_unlock(SCARD_LOCK_TCP);
|
scard_unlock(SCARD_LOCK_TCP);
|
||||||
#endif
|
#endif
|
||||||
@ -585,32 +578,12 @@ tcp_reset_state(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Clear the incoming stream */
|
/* Clear the incoming stream */
|
||||||
if (g_in.data != NULL)
|
s_reset(&g_in);
|
||||||
xfree(g_in.data);
|
|
||||||
g_in.p = NULL;
|
|
||||||
g_in.end = NULL;
|
|
||||||
g_in.data = NULL;
|
|
||||||
g_in.size = 0;
|
|
||||||
g_in.iso_hdr = NULL;
|
|
||||||
g_in.mcs_hdr = NULL;
|
|
||||||
g_in.sec_hdr = NULL;
|
|
||||||
g_in.rdp_hdr = NULL;
|
|
||||||
g_in.channel_hdr = NULL;
|
|
||||||
|
|
||||||
/* Clear the outgoing stream(s) */
|
/* Clear the outgoing stream(s) */
|
||||||
for (i = 0; i < STREAM_COUNT; i++)
|
for (i = 0; i < STREAM_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (g_out[i].data != NULL)
|
s_reset(&g_out[i]);
|
||||||
xfree(g_out[i].data);
|
|
||||||
g_out[i].p = NULL;
|
|
||||||
g_out[i].end = NULL;
|
|
||||||
g_out[i].data = NULL;
|
|
||||||
g_out[i].size = 0;
|
|
||||||
g_out[i].iso_hdr = NULL;
|
|
||||||
g_out[i].mcs_hdr = NULL;
|
|
||||||
g_out[i].sec_hdr = NULL;
|
|
||||||
g_out[i].rdp_hdr = NULL;
|
|
||||||
g_out[i].channel_hdr = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user