aboutsummaryrefslogtreecommitdiffstats
path: root/src/output.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-11 00:03:48 +0200
committerMattias Andrée <maandree@kth.se>2016-07-11 00:03:48 +0200
commit0a56172712a70ac5fcfc3ddcf725d78045c599d3 (patch)
treedc27eeb334a44f9bb7a6c577cbf421684d0c4af8 /src/output.c
parentm (diff)
downloadcoopgammad-0a56172712a70ac5fcfc3ddcf725d78045c599d3.tar.gz
coopgammad-0a56172712a70ac5fcfc3ddcf725d78045c599d3.tar.bz2
coopgammad-0a56172712a70ac5fcfc3ddcf725d78045c599d3.tar.xz
Sort outputs by name
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/output.c')
-rw-r--r--src/output.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/output.c b/src/output.c
index 2e399bf..d6fae94 100644
--- a/src/output.c
+++ b/src/output.c
@@ -205,3 +205,19 @@ size_t output_unmarshal(struct output* this, const char* buf)
return off;
}
+
+/**
+ * Compare to outputs by the names of their respective CRTC:s
+ *
+ * @param a Return -1 if this one is lower
+ * @param b Return +1 if this one is higher
+ * @return See description of `a` and `b`,
+ * 0 if returned if they are the same
+ */
+int output_cmp_by_name(const void* a, const void* b)
+{
+ const char* an = ((const struct output*)a)->name;
+ const char* bn = ((const struct output*)b)->name;
+ return strcmp(an, bn);
+}
+