Doing stuff?
This commit is contained in:
parent
86b099bd58
commit
f4e290229b
2 changed files with 15 additions and 8 deletions
|
@ -46,9 +46,9 @@ typedef struct _patty_ax25_if {
|
|||
} patty_ax25_if;
|
||||
|
||||
typedef struct _patty_ax25 {
|
||||
patty_dict * ax25_ifs; /* Key: AX.25 interface name */
|
||||
patty_dict * ports; /* Key: Integer port descriptor */
|
||||
patty_dict * links; /* Key: Integer link descriptor */
|
||||
patty_dict * ifaces; /* Key: AX.25 interface name */
|
||||
patty_dict * ports; /* Key: Integer port descriptor */
|
||||
patty_dict * links; /* Key: Integer link descriptor */
|
||||
} patty_ax25;
|
||||
|
||||
int patty_ax25_init(patty_ax25 *ax25);
|
||||
|
|
17
src/ax25.c
17
src/ax25.c
|
@ -9,8 +9,8 @@
|
|||
int patty_ax25_init(patty_ax25 *ax25) {
|
||||
memset(ax25, '\0', sizeof(*ax25));
|
||||
|
||||
if ((ax25->ax25_ifs = patty_dict_new()) == NULL) {
|
||||
goto error_dict_new_ax25_ifs;
|
||||
if ((ax25->ifaces = patty_dict_new()) == NULL) {
|
||||
goto error_dict_new_ifaces;
|
||||
}
|
||||
|
||||
if ((ax25->ports = patty_dict_new()) == NULL) {
|
||||
|
@ -27,16 +27,16 @@ error_dict_new_links:
|
|||
patty_dict_destroy(ax25->ports);
|
||||
|
||||
error_dict_new_ports:
|
||||
patty_dict_destroy(ax25->ax25_ifs);
|
||||
patty_dict_destroy(ax25->ifaces);
|
||||
|
||||
error_dict_new_ax25_ifs:
|
||||
error_dict_new_ifaces:
|
||||
return -1;
|
||||
}
|
||||
|
||||
void patty_ax25_finish(patty_ax25 *ax25) {
|
||||
patty_dict_destroy(ax25->links);
|
||||
patty_dict_destroy(ax25->ports);
|
||||
patty_dict_destroy(ax25->ax25_ifs);
|
||||
patty_dict_destroy(ax25->ifaces);
|
||||
}
|
||||
|
||||
static int create_if_tnc(patty_ax25 *ax25, const char *device) {
|
||||
|
@ -56,8 +56,15 @@ static int create_if_tnc(patty_ax25 *ax25, const char *device) {
|
|||
goto error_kiss_tnc_open;
|
||||
}
|
||||
|
||||
if (patty_dict_set(ax25->ifaces, (void *)device, strlen(device), iface) == NULL) {
|
||||
goto error_dict_set_iface;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error_dict_set_iface:
|
||||
patty_kiss_tnc_close(iface->tnc);
|
||||
|
||||
error_kiss_tnc_open:
|
||||
patty_dict_destroy(iface->ports);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue