From 36fd84cc42ebb2933d24c2d3d4b84f3f32f065b0 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Fri, 3 Aug 2018 10:40:09 -0400 Subject: [PATCH] Remove swaynag_clone and use memcpy --- include/sway/swaynag.h | 4 ---- sway/config.c | 5 +++-- sway/swaynag.c | 9 --------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/include/sway/swaynag.h b/include/sway/swaynag.h index ac0086a16..5a1787392 100644 --- a/include/sway/swaynag.h +++ b/include/sway/swaynag.h @@ -8,10 +8,6 @@ struct swaynag_instance { bool detailed; }; -// Copy all fields of one instance to another -void swaynag_clone(struct swaynag_instance *dest, - struct swaynag_instance *src); - // Spawn swaynag. If swaynag->detailed, then swaynag->fd[1] will left open // so it can be written to. Call swaynag_show when done writing. This will // be automatically called by swaynag_log if the instance is not spawned and diff --git a/sway/config.c b/sway/config.c index 4464b0068..c1ec77f9b 100644 --- a/sway/config.c +++ b/sway/config.c @@ -386,8 +386,9 @@ bool load_main_config(const char *file, bool is_active, bool validating) { config->active = true; swaynag_kill(&old_config->swaynag_config_errors); - swaynag_clone(&config->swaynag_config_errors, - &old_config->swaynag_config_errors); + memcpy(&config->swaynag_config_errors, + &old_config->swaynag_config_errors, + sizeof(struct swaynag_instance)); create_default_output_configs(); } diff --git a/sway/swaynag.c b/sway/swaynag.c index 2dc0cb216..f53708076 100644 --- a/sway/swaynag.c +++ b/sway/swaynag.c @@ -8,15 +8,6 @@ #include "log.h" #include "sway/swaynag.h" -void swaynag_clone(struct swaynag_instance *dest, - struct swaynag_instance *src) { - dest->args = src->args; - dest->pid = src->pid; - dest->fd[0] = src->fd[0]; - dest->fd[1] = src->fd[1]; - dest->detailed = src->detailed; -} - bool swaynag_spawn(const char *swaynag_command, struct swaynag_instance *swaynag) { if (swaynag->detailed) {