29 lines
562 B
C
29 lines
562 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
#include <patty/ax25/address.h>
|
||
|
|
||
|
patty_ax25_address *patty_ax25_address_create(const char *callsign, int ssid) {
|
||
|
patty_ax25_address *addr;
|
||
|
|
||
|
if ((addr = malloc(sizeof(*addr))) == NULL) {
|
||
|
goto error_malloc_addr;
|
||
|
}
|
||
|
|
||
|
strncpy(addr->callsign, callsign, sizeof(addr->callsign));
|
||
|
|
||
|
addr->ssid = ssid;
|
||
|
addr->last = 0;
|
||
|
addr->c = 0;
|
||
|
|
||
|
return addr;
|
||
|
|
||
|
error_malloc_addr:
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
void patty_ax25_address_destroy(patty_ax25_address *address) {
|
||
|
free(address);
|
||
|
}
|