]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Clean up with clang-format
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Sun, 24 Jan 2021 21:32:57 +0000 (21:32 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Sun, 24 Jan 2021 21:32:57 +0000 (21:32 +0000)
common.c
dacp.c
rtsp.c

index 8520c71475694cd92022c4ab19dbaaabc991968f..6e0f12ab65613d07ccfdf1b2b4d9a7834d47f890 100644 (file)
--- a/common.c
+++ b/common.c
@@ -834,7 +834,7 @@ void command_set_volume(double volume) {
           _exit(EXIT_FAILURE); /* only if execv fails */
         }
       }
-    _exit(EXIT_SUCCESS);
+      _exit(EXIT_SUCCESS);
     } else {
       if (config.cmd_blocking) { /* pid!=0 means parent process and if blocking is true, wait for
                                     process to finish */
diff --git a/dacp.c b/dacp.c
index effbe5ecc18d451ce093332a47199bfb3e412cb2..0230ac1cc0c14d04cbaa8b2cb8bd93c181f832b1 100644 (file)
--- a/dacp.c
+++ b/dacp.c
@@ -446,11 +446,11 @@ void set_dacp_server_information(rtsp_conn_info *conn) {
   if (dacp_server.active_remote_id)
     free(dacp_server.active_remote_id);
   if (conn->dacp_active_remote)
-               dacp_server.active_remote_id =
-                               strdup(conn->dacp_active_remote); // even if the dacp_id remains the same,
-                                                                                                                                                                       // the active remote will change.
+    dacp_server.active_remote_id =
+        strdup(conn->dacp_active_remote); // even if the dacp_id remains the same,
+                                          // the active remote will change.
   else
-       dacp_server.active_remote_id = NULL;
+    dacp_server.active_remote_id = NULL;
 
   debug(3, "set_dacp_server_information set active-remote id to %s.", dacp_server.active_remote_id);
   pthread_cond_signal(&dacp_server_information_cv);
diff --git a/rtsp.c b/rtsp.c
index f3524ae2c93df83990546c9dedc34b4deea07f13..2661ccec6b38d93ac1e2c3f3cc7ada1746de7c21 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -1652,40 +1652,41 @@ void *metadata_mqtt_thread_function(__attribute__((unused)) void *ignore) {
 #endif
 
 void metadata_init(void) {
-       int ret;
-       if (config.metadata_enabled) {
-               // create the metadata pipe, if necessary
-               size_t pl = strlen(config.metadata_pipename) + 1;
-               char *path = malloc(pl + 1);
-               snprintf(path, pl + 1, "%s", config.metadata_pipename);
-               mode_t oldumask = umask(000);
-               if (mkfifo(path, 0666) && errno != EEXIST)
-                       die("Could not create metadata pipe \"%s\".", path);
-               umask(oldumask);
-               debug(1, "metadata pipe name is \"%s\".", path);
-
-               // try to open it
-               fd = try_to_open_pipe_for_writing(path);
-               // we check that it's not a "real" error. From the "man 2 open" page:
-               // "ENXIO  O_NONBLOCK | O_WRONLY is set, the named file is a FIFO, and no process has the FIFO
-               // open for reading." Which is okay.
-               if ((fd == -1) && (errno != ENXIO)) {
-                       char errorstring[1024];
-                       strerror_r(errno, (char *)errorstring, sizeof(errorstring));
-                       debug(1, "metadata_hub_thread_function -- error %d (\"%s\") opening pipe: \"%s\".", errno,
-                                               (char *)errorstring, path);
-                       warn("can not open metadata pipe -- error %d (\"%s\") opening pipe: \"%s\".", errno,
-                                        (char *)errorstring, path);
-               }
-               free(path);
-               int ret;
-               ret = pthread_create(&metadata_thread, NULL, metadata_thread_function, NULL);
-               if (ret)
-                       debug(1, "Failed to create metadata thread!");
-
-               ret = pthread_create(&metadata_multicast_thread, NULL, metadata_multicast_thread_function, NULL);
-               if (ret)
-                       debug(1, "Failed to create metadata multicast thread!");
+  int ret;
+  if (config.metadata_enabled) {
+    // create the metadata pipe, if necessary
+    size_t pl = strlen(config.metadata_pipename) + 1;
+    char *path = malloc(pl + 1);
+    snprintf(path, pl + 1, "%s", config.metadata_pipename);
+    mode_t oldumask = umask(000);
+    if (mkfifo(path, 0666) && errno != EEXIST)
+      die("Could not create metadata pipe \"%s\".", path);
+    umask(oldumask);
+    debug(1, "metadata pipe name is \"%s\".", path);
+
+    // try to open it
+    fd = try_to_open_pipe_for_writing(path);
+    // we check that it's not a "real" error. From the "man 2 open" page:
+    // "ENXIO  O_NONBLOCK | O_WRONLY is set, the named file is a FIFO, and no process has the FIFO
+    // open for reading." Which is okay.
+    if ((fd == -1) && (errno != ENXIO)) {
+      char errorstring[1024];
+      strerror_r(errno, (char *)errorstring, sizeof(errorstring));
+      debug(1, "metadata_hub_thread_function -- error %d (\"%s\") opening pipe: \"%s\".", errno,
+            (char *)errorstring, path);
+      warn("can not open metadata pipe -- error %d (\"%s\") opening pipe: \"%s\".", errno,
+           (char *)errorstring, path);
+    }
+    free(path);
+    int ret;
+    ret = pthread_create(&metadata_thread, NULL, metadata_thread_function, NULL);
+    if (ret)
+      debug(1, "Failed to create metadata thread!");
+
+    ret =
+        pthread_create(&metadata_multicast_thread, NULL, metadata_multicast_thread_function, NULL);
+    if (ret)
+      debug(1, "Failed to create metadata multicast thread!");
   }
 #ifdef CONFIG_METADATA_HUB
   ret = pthread_create(&metadata_hub_thread, NULL, metadata_hub_thread_function, NULL);
@@ -1715,19 +1716,19 @@ void metadata_stop(void) {
     pthread_join(metadata_hub_thread, NULL);
     // debug(2, "metadata stop hub done.");
 #endif
-               if (config.metadata_enabled) {
-                       // debug(2, "metadata stop multicast thread.");
-                       if (metadata_multicast_thread) {
-                               pthread_cancel(metadata_multicast_thread);
-                               pthread_join(metadata_multicast_thread, NULL);
-                               // debug(2, "metadata stop multicast done.");
-                       }
-                       if (metadata_thread) {
-                               // debug(2, "metadata stop metadata_thread thread.");
-                               pthread_cancel(metadata_thread);
-                               pthread_join(metadata_thread, NULL);
-                               // debug(2, "metadata_stop finished successfully.");
-                       }
+    if (config.metadata_enabled) {
+      // debug(2, "metadata stop multicast thread.");
+      if (metadata_multicast_thread) {
+        pthread_cancel(metadata_multicast_thread);
+        pthread_join(metadata_multicast_thread, NULL);
+        // debug(2, "metadata stop multicast done.");
+      }
+      if (metadata_thread) {
+        // debug(2, "metadata stop metadata_thread thread.");
+        pthread_cancel(metadata_thread);
+        pthread_join(metadata_thread, NULL);
+        // debug(2, "metadata_stop finished successfully.");
+      }
     }
   }
 }
@@ -1799,8 +1800,9 @@ int send_metadata(uint32_t type, uint32_t code, char *data, uint32_t length, rts
                   int block) {
   int rc;
   if (config.metadata_enabled) {
-       rc = send_metadata_to_queue(&metadata_queue, type, code, data, length, carrier, block);
-       rc = send_metadata_to_queue(&metadata_multicast_queue, type, code, data, length, carrier, block);
+    rc = send_metadata_to_queue(&metadata_queue, type, code, data, length, carrier, block);
+    rc =
+        send_metadata_to_queue(&metadata_multicast_queue, type, code, data, length, carrier, block);
   }
 
 #ifdef CONFIG_METADATA_HUB