blob: 08d9aa29608e818621fd853521ef0b9bd91d796f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "pn_trans.h"
#include <glib.h>
struct pn_trans *
pn_trans_new(void)
{
return g_new0(struct pn_trans, 1);
}
void
pn_trans_free(struct pn_trans *trans)
{
if (!trans)
return;
g_free(trans->command);
g_free(trans->params);
g_free(trans);
}
char *
pn_trans_to_string(struct pn_trans *trans)
{
char *str;
if (trans->params)
str = g_strdup_printf("%s %u %s\r\n",
trans->command, trans->id, trans->params);
else
str = g_strdup_printf("%s %u\r\n",
trans->command, trans->id);
return str;
}
|