Skip to content

Commit

Permalink
conf: Rename if_t to axel_if_t
Browse files Browse the repository at this point in the history
The if_t type conflicts with FreeBSD's if_t in <net/if.h>.

Closes: #446
Ref: #443
Reported-by: Yonas Yanfa <yonas.y@gmail.com>
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
  • Loading branch information
ismaell committed Aug 26, 2024
1 parent f71d874 commit 3c21dc4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/axel.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typedef struct {
} message_t;

typedef message_t url_t;
typedef message_t if_t;
typedef message_t axel_if_t;

#include "abuf.h"
#include "conf.h"
Expand Down
12 changes: 6 additions & 6 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ conf_init(conf_t *conf)
"User-Agent", DEFAULT_USER_AGENT);
conf->add_header_count = HDR_count_init;

conf->interfaces = calloc(1, sizeof(if_t));
conf->interfaces = calloc(1, sizeof(*conf->interfaces));
if (!conf->interfaces)
return 0;

Expand Down Expand Up @@ -329,11 +329,11 @@ int
parse_interfaces(conf_t *conf, char *s)
{
char *s2;
if_t *iface;
axel_if_t *iface;

iface = conf->interfaces->next;
while (iface != conf->interfaces) {
if_t *i;
axel_if_t *i;

i = iface->next;
free(iface);
Expand All @@ -342,15 +342,15 @@ parse_interfaces(conf_t *conf, char *s)
free(conf->interfaces);

if (!*s) {
conf->interfaces = calloc(1, sizeof(if_t));
conf->interfaces = calloc(1, sizeof(*conf->interfaces));
if (!conf->interfaces)
return 0;

conf->interfaces->next = conf->interfaces;
return 1;
}

conf->interfaces = iface = malloc(sizeof(if_t));
conf->interfaces = iface = malloc(sizeof(*iface));
if (!conf->interfaces)
return 0;

Expand All @@ -365,7 +365,7 @@ parse_interfaces(conf_t *conf, char *s)
strlcpy(iface->text, s, sizeof(iface->text));
s = s2 + 1;
if (*s) {
iface->next = malloc(sizeof(if_t));
iface->next = malloc(sizeof(*iface));
if (!iface->next)
return 0;

Expand Down
2 changes: 1 addition & 1 deletion src/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ typedef struct {
AXEL_PROGRESS_STYLE_PERCENTAGE,
} progress_style;

if_t *interfaces;
axel_if_t *interfaces;

sa_family_t ai_family;

Expand Down

0 comments on commit 3c21dc4

Please sign in to comment.