aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/config.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-04 10:44:42 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2018-09-04 11:08:29 -0600
commit6214b358a5502915d977d3f850d34bcad71c4cde (patch)
tree3f8849570e0ecbb60e9778ab38225705e1f46101 /src/tools/config.c
parentglobal: satisfy check_patch.pl errors (diff)
downloadwireguard-monolithic-historical-6214b358a5502915d977d3f850d34bcad71c4cde.tar.xz
wireguard-monolithic-historical-6214b358a5502915d977d3f850d34bcad71c4cde.zip
global: prefer sizeof(*pointer) when possible
Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
Diffstat (limited to 'src/tools/config.c')
-rw-r--r--src/tools/config.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/config.c b/src/tools/config.c
index 8e327be..93525fb 100644
--- a/src/tools/config.c
+++ b/src/tools/config.c
@@ -310,7 +310,7 @@ static inline bool parse_allowedips(struct wgpeer *peer, struct wgallowedip **la
saved_entry = strdup(mask);
ip = strsep(&mask, "/");
- new_allowedip = calloc(1, sizeof(struct wgallowedip));
+ new_allowedip = calloc(1, sizeof(*new_allowedip));
if (!new_allowedip) {
perror("calloc");
free(saved_entry);
@@ -464,8 +464,8 @@ out:
bool config_read_init(struct config_ctx *ctx, bool append)
{
- memset(ctx, 0, sizeof(struct config_ctx));
- ctx->device = calloc(1, sizeof(struct wgdevice));
+ memset(ctx, 0, sizeof(*ctx));
+ ctx->device = calloc(1, sizeof(*ctx->device));
if (!ctx->device) {
perror("calloc");
return false;
@@ -511,7 +511,7 @@ static char *strip_spaces(const char *in)
struct wgdevice *config_read_cmd(char *argv[], int argc)
{
- struct wgdevice *device = calloc(1, sizeof(struct wgdevice));
+ struct wgdevice *device = calloc(1, sizeof(*device));
struct wgpeer *peer = NULL;
struct wgallowedip *allowedip = NULL;
@@ -537,7 +537,7 @@ struct wgdevice *config_read_cmd(char *argv[], int argc)
argv += 2;
argc -= 2;
} else if (!strcmp(argv[0], "peer") && argc >= 2) {
- struct wgpeer *new_peer = calloc(1, sizeof(struct wgpeer));
+ struct wgpeer *new_peer = calloc(1, sizeof(*new_peer));
allowedip = NULL;
if (!new_peer) {