summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-03 10:40:09 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-03 10:40:09 -0400
commit36fd84cc42ebb2933d24c2d3d4b84f3f32f065b0 (patch)
tree7982d1f38fcb3620372c1c8461de1450063e5355
parentWrite to swaynag pipe fd directly on config errors (diff)
downloadsway-36fd84cc42ebb2933d24c2d3d4b84f3f32f065b0.tar.gz
sway-36fd84cc42ebb2933d24c2d3d4b84f3f32f065b0.tar.zst
sway-36fd84cc42ebb2933d24c2d3d4b84f3f32f065b0.zip
Remove swaynag_clone and use memcpy
-rw-r--r--include/sway/swaynag.h4
-rw-r--r--sway/config.c5
-rw-r--r--sway/swaynag.c9
3 files changed, 3 insertions, 15 deletions
diff --git a/include/sway/swaynag.h b/include/sway/swaynag.h
index ac0086a1..5a178739 100644
--- a/include/sway/swaynag.h
+++ b/include/sway/swaynag.h
@@ -8,10 +8,6 @@ struct swaynag_instance {
8 bool detailed; 8 bool detailed;
9}; 9};
10 10
11// Copy all fields of one instance to another
12void swaynag_clone(struct swaynag_instance *dest,
13 struct swaynag_instance *src);
14
15// Spawn swaynag. If swaynag->detailed, then swaynag->fd[1] will left open 11// Spawn swaynag. If swaynag->detailed, then swaynag->fd[1] will left open
16// so it can be written to. Call swaynag_show when done writing. This will 12// so it can be written to. Call swaynag_show when done writing. This will
17// be automatically called by swaynag_log if the instance is not spawned and 13// be automatically called by swaynag_log if the instance is not spawned and
diff --git a/sway/config.c b/sway/config.c
index 4464b006..c1ec77f9 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) {
386 config->active = true; 386 config->active = true;
387 387
388 swaynag_kill(&old_config->swaynag_config_errors); 388 swaynag_kill(&old_config->swaynag_config_errors);
389 swaynag_clone(&config->swaynag_config_errors, 389 memcpy(&config->swaynag_config_errors,
390 &old_config->swaynag_config_errors); 390 &old_config->swaynag_config_errors,
391 sizeof(struct swaynag_instance));
391 392
392 create_default_output_configs(); 393 create_default_output_configs();
393 } 394 }
diff --git a/sway/swaynag.c b/sway/swaynag.c
index 2dc0cb21..f5370807 100644
--- a/sway/swaynag.c
+++ b/sway/swaynag.c
@@ -8,15 +8,6 @@
8#include "log.h" 8#include "log.h"
9#include "sway/swaynag.h" 9#include "sway/swaynag.h"
10 10
11void swaynag_clone(struct swaynag_instance *dest,
12 struct swaynag_instance *src) {
13 dest->args = src->args;
14 dest->pid = src->pid;
15 dest->fd[0] = src->fd[0];
16 dest->fd[1] = src->fd[1];
17 dest->detailed = src->detailed;
18}
19
20bool swaynag_spawn(const char *swaynag_command, 11bool swaynag_spawn(const char *swaynag_command,
21 struct swaynag_instance *swaynag) { 12 struct swaynag_instance *swaynag) {
22 if (swaynag->detailed) { 13 if (swaynag->detailed) {