]> git.puffer.fish Git - mirror/frr.git/commitdiff
pceplib: fix style issues 10177/head
authorQuentin Young <qlyoung@nvidia.com>
Mon, 6 Dec 2021 05:06:23 +0000 (00:06 -0500)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 6 Dec 2021 05:09:13 +0000 (00:09 -0500)
run clang-format
run clang-format
run clang-format
run clang-format
run clang-format

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
pceplib/pcep_msg_objects.h
pceplib/pcep_msg_tools.c
pceplib/pcep_pcc.c
pceplib/pcep_session_logic.c
pceplib/test/pcep_msg_messages_test.c
pceplib/test/pcep_msg_tools_test.c
pceplib/test/pcep_session_logic_loop_test.c

index f26618e2917df8e9e349a5fc11bba877267a0ffb..270db4aa8dc23468530687a3e704513e8eeaceb8 100644 (file)
@@ -367,7 +367,7 @@ enum pcep_lsp_operational_status {
 };
 
 #define MAX_PLSP_ID 0x000fffff /* The plsp_id is only 20 bits */
-#define MAX_LSP_STATUS 0x0007 /* The status is only 3 bits */
+#define MAX_LSP_STATUS 0x0007  /* The status is only 3 bits */
 #define OBJECT_LSP_FLAG_D 0x01
 #define OBJECT_LSP_FLAG_S 0x02
 #define OBJECT_LSP_FLAG_R 0x04
index 8f32f2c537c2e8af234c9b6e7a50e7294c78eb3a..f7c25f447b27057b9a91d68e11de2ba3b336ceae 100644 (file)
@@ -144,14 +144,15 @@ double_linked_list *pcep_msg_read(int sock_fd)
                                "%s: pcep_msg_read: Message not fully read! Trying to read %d bytes more, fd [%d]",
                                __func__, read_len, sock_fd);
 
-                       if (PCEP_MESSAGE_LENGTH - ret - buffer_read >= read_len )
+                       if (PCEP_MESSAGE_LENGTH - ret - buffer_read >= read_len)
                                read_ret =
                                        read(sock_fd, &buffer[ret], read_len);
                        else {
                                pcep_log(
                                        LOG_ERR,
                                        "%s: Trying to read size (%d) offset (%d) in a buff of size (%d)",
-                                       __func__, read_len, ret, PCEP_MESSAGE_LENGTH);
+                                       __func__, read_len, ret,
+                                       PCEP_MESSAGE_LENGTH);
                                return msg_list;
                        }
 
index d263f64f39b8628ac0ad207225293143d5c21ee1..649704f55b99a90ffe179ef0b01867fb978e858d 100644 (file)
@@ -273,7 +273,7 @@ void send_pce_report_message(pcep_session *session)
                pcep_log(LOG_WARNING,
                         "%s: send_pce_report_message SRP object was NULL",
                         __func__);
-                       dll_destroy_with_data(report_list);
+               dll_destroy_with_data(report_list);
                return;
        }
        dll_append(report_list, obj);
@@ -314,7 +314,7 @@ void send_pce_report_message(pcep_session *session)
                pcep_log(LOG_WARNING,
                         "%s: send_pce_report_message LSP object was NULL",
                         __func__);
-                       dll_destroy_with_data(report_list);
+               dll_destroy_with_data(report_list);
                return;
        }
        dll_append(report_list, obj);
@@ -351,7 +351,7 @@ void send_pce_report_message(pcep_session *session)
                pcep_log(LOG_WARNING,
                         "%s: send_pce_report_message ERO object was NULL",
                         __func__);
-                       dll_destroy_with_data(report_list);
+               dll_destroy_with_data(report_list);
                return;
        }
        dll_append(report_list, obj);
index ce898d1bf58a7faafc237c846ed000a4069dc3e4..78d1072552e2b0cb20c159cfc04825506681ce28 100644 (file)
@@ -590,12 +590,14 @@ struct pcep_message *create_pcep_open(pcep_session *session)
                                /* I flag */
                                session->pcc_config
                                        .support_pce_lsp_instantiation,
-                       /* T flag */
-                       session->pcc_config.support_lsp_triggered_resync,
-                       /* D flag */
-                       session->pcc_config.support_lsp_delta_sync,
-                       /* F flag */
-                       session->pcc_config.support_pce_triggered_initial_sync));
+                               /* T flag */
+                               session->pcc_config
+                                       .support_lsp_triggered_resync,
+                               /* D flag */
+                               session->pcc_config.support_lsp_delta_sync,
+                               /* F flag */
+                               session->pcc_config
+                                       .support_pce_triggered_initial_sync));
        }
 
        if (session->pcc_config.support_include_db_version) {
index 6ae449acd15d2fb36dc097fc17abf4e5ca57acf6..3fec24a22585122e66c6d8af6c83155f2cc02cf4 100644 (file)
@@ -119,7 +119,7 @@ void test_pcep_msg_create_request()
        /* Test IPv4 */
        struct pcep_object_rp *rp_obj =
                pcep_obj_create_rp(0, false, false, false, false, 10, NULL);
-       struct in_addr src_addr={}, dst_addr={};
+       struct in_addr src_addr = {}, dst_addr = {};
        struct pcep_object_endpoints_ipv4 *ipv4_obj =
                pcep_obj_create_endpoint_ipv4(&src_addr, &dst_addr);
        message = pcep_msg_create_request(rp_obj, ipv4_obj, NULL);
index 05f8bfb547483833cd72b2c29ebcf458ec97f95e..ffbe802d34519eddfeb7626a128fcee84aee10d3 100644 (file)
@@ -174,12 +174,11 @@ static int BASE_TMPFILE_SIZE = sizeof(BASE_TMPFILE);
 
 /* Reads an array of hexbyte strs, and writes them to a temporary file.
  * The caller should close the returned file. */
-int convert_hexstrs_to_binary(char *filename,
-                             const char *hexbyte_strs[],
+int convert_hexstrs_to_binary(char *filename, const char *hexbyte_strs[],
                              uint16_t hexbyte_strs_length)
 {
        mode_t oldumask;
-       oldumask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
+       oldumask = umask(S_IXUSR | S_IXGRP | S_IWOTH | S_IROTH | S_IXOTH);
        /* Set umask before anything for security */
        umask(0027);
 
@@ -216,11 +215,10 @@ void test_pcep_msg_read_pcep_initiate()
 {
        char filename[BASE_TMPFILE_SIZE];
 
-       int fd = convert_hexstrs_to_binary(filename,
-                                          pcep_initiate_hexbyte_strs,
+       int fd = convert_hexstrs_to_binary(filename, pcep_initiate_hexbyte_strs,
                                           pcep_initiate_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
@@ -321,11 +319,11 @@ void test_pcep_msg_read_pcep_initiate2()
 {
        char filename[BASE_TMPFILE_SIZE];
 
-       int fd = convert_hexstrs_to_binary(filename,
-                                          pcep_initiate2_hexbyte_strs,
-                                          pcep_initiate2_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       int fd =
+               convert_hexstrs_to_binary(filename, pcep_initiate2_hexbyte_strs,
+                                         pcep_initiate2_hexbyte_strs_length);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
@@ -414,11 +412,10 @@ void test_pcep_msg_read_pcep_open()
 {
        char filename[BASE_TMPFILE_SIZE];
 
-       int fd = convert_hexstrs_to_binary(filename,
-                                          pcep_open_odl_hexbyte_strs,
+       int fd = convert_hexstrs_to_binary(filename, pcep_open_odl_hexbyte_strs,
                                           pcep_open_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
@@ -463,11 +460,10 @@ void test_pcep_msg_read_pcep_update()
 {
        char filename[BASE_TMPFILE_SIZE];
 
-       int fd = convert_hexstrs_to_binary(filename,
-                                          pcep_update_hexbyte_strs,
+       int fd = convert_hexstrs_to_binary(filename, pcep_update_hexbyte_strs,
                                           pcep_update_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
@@ -553,8 +549,8 @@ void test_pcep_msg_read_pcep_open_initiate()
        int fd = convert_hexstrs_to_binary(
                filename, pcep_open_initiate_odl_hexbyte_strs,
                pcep_open_initiate_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
@@ -586,8 +582,8 @@ void test_pcep_msg_read_pcep_open_cisco_pce()
        int fd = convert_hexstrs_to_binary(
                filename, pcep_open_cisco_pce_hexbyte_strs,
                pcep_open_cisco_pce_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
@@ -653,8 +649,8 @@ void test_pcep_msg_read_pcep_update_cisco_pce()
        int fd = convert_hexstrs_to_binary(
                filename, pcep_update_cisco_pce_hexbyte_strs,
                pcep_update_cisco_pce_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
@@ -801,8 +797,8 @@ void test_pcep_msg_read_pcep_report_cisco_pcc()
        int fd = convert_hexstrs_to_binary(
                filename, pcep_report_cisco_pcc_hexbyte_strs,
                pcep_report_cisco_pcc_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
@@ -966,8 +962,8 @@ void test_pcep_msg_read_pcep_initiate_cisco_pcc()
        int fd = convert_hexstrs_to_binary(
                filename, pcep_initiate_cisco_pcc_hexbyte_strs,
                pcep_initiate_cisco_pcc_hexbyte_strs_length);
-       if(fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        double_linked_list *msg_list = pcep_msg_read(fd);
index 96beceac597982869c0ce340ea05f0a02d6eb998..7a4271528365dfb41f0f0725ae7a4bb59732d941 100644 (file)
@@ -140,14 +140,14 @@ void test_session_logic_msg_ready_handler()
        /* Read from an empty file should return 0, thus
         * session_logic_msg_ready_handler returns -1 */
        mode_t oldumask;
-       oldumask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
+       oldumask = umask(S_IXUSR | S_IXGRP | S_IWOTH | S_IROTH | S_IXOTH);
        /* Set umask before anything for security */
        umask(0027);
        char tmpfile[] = "/tmp/pceplib_XXXXXX";
        int fd = mkstemp(tmpfile);
        umask(oldumask);
-       if (fd == -1){
-               CU_ASSERT_TRUE(fd>=0);
+       if (fd == -1) {
+               CU_ASSERT_TRUE(fd >= 0);
                return;
        }
        pcep_session session;