Remove naming redundancy in src/frame.c

This commit is contained in:
XANTRONIX Development 2020-05-23 15:10:42 -04:00 committed by XANTRONIX Industrial
parent 241f647b03
commit e8e1c163a4

View file

@ -3,9 +3,9 @@
#include <patty/ax25.h>
static ssize_t frame_decode_station(patty_ax25_address *address,
void *data,
off_t offset) {
static ssize_t decode_station(patty_ax25_address *address,
void *data,
off_t offset) {
int i, space = 0;
uint8_t ssid = ((uint8_t *)data + offset)[6];
@ -61,9 +61,9 @@ error:
return -1;
}
static ssize_t frame_decode_hops(patty_ax25_frame *frame,
void *data,
off_t start) {
static ssize_t decode_hops(patty_ax25_frame *frame,
void *data,
off_t start) {
ssize_t decoded;
off_t offset = start;
@ -74,7 +74,7 @@ static ssize_t frame_decode_hops(patty_ax25_frame *frame,
* frame.
*/
for (i=0; i<PATTY_AX25_MAX_HOPS; i++) {
if ((decoded = frame_decode_station(&frame->repeaters[i], data, offset)) < 0) {
if ((decoded = decode_station(&frame->repeaters[i], data, offset)) < 0) {
goto error;
} else {
offset += decoded;
@ -105,13 +105,13 @@ error:
return -1;
}
static ssize_t frame_decode_address(patty_ax25_frame *frame,
void *data,
off_t start) {
static ssize_t decode_address(patty_ax25_frame *frame,
void *data,
off_t start) {
off_t offset = start;
ssize_t decoded;
if ((decoded = frame_decode_station(&frame->dest, data, offset)) < 0) {
if ((decoded = decode_station(&frame->dest, data, offset)) < 0) {
goto error;
} else {
offset += decoded;
@ -121,7 +121,7 @@ static ssize_t frame_decode_address(patty_ax25_frame *frame,
* It would be considered erroneous if the destination address did have the
* extension bit set to 1.
*/
if ((decoded = frame_decode_station(&frame->src, data, offset)) < 0) {
if ((decoded = decode_station(&frame->src, data, offset)) < 0) {
goto error;
} else {
offset += decoded;
@ -146,7 +146,7 @@ static ssize_t frame_decode_address(patty_ax25_frame *frame,
* decoding repeater addresses.
*/
if (!frame->src.last) {
if ((decoded = frame_decode_hops(frame, data, offset)) < 0) {
if ((decoded = decode_hops(frame, data, offset)) < 0) {
goto error;
} else {
offset += decoded;
@ -159,9 +159,9 @@ error:
return -1;
}
static ssize_t frame_decode_payload(patty_ax25_frame *frame,
void *data,
off_t offset) {
static ssize_t decode_payload(patty_ax25_frame *frame,
void *data,
off_t offset) {
uint8_t control = ((uint8_t *)data + offset)[0];
size_t decoded = 0;
@ -223,7 +223,7 @@ int patty_ax25_frame_decode(patty_ax25_frame *frame, void *data, size_t size) {
/*
* First, decode the variable-length Address field.
*/
if ((decoded = frame_decode_address(frame, data, offset)) < 0) {
if ((decoded = decode_address(frame, data, offset)) < 0) {
errno = EIO;
goto error_decode;
@ -235,7 +235,7 @@ int patty_ax25_frame_decode(patty_ax25_frame *frame, void *data, size_t size) {
* Next, decode the remaining Control Field, optional Protocol Identifier
* field, and payload that may follow.
*/
if ((decoded = frame_decode_payload(frame, data, offset)) < 0) {
if ((decoded = decode_payload(frame, data, offset)) < 0) {
errno = EIO;
goto error_decode;