From 42516f6ebc2506ad76c2f960b93f63645d05c262 Mon Sep 17 00:00:00 2001 From: Juuso Alasuutari Date: Wed, 8 Jan 2025 13:30:56 +0200 Subject: [PATCH] [C][Client] Cosmetic: remove unnecessary parens, align some lines --- .../resources/C-libcurl/apiClient.c.mustache | 28 ++++++------------- .../main/resources/C-libcurl/list.c.mustache | 2 +- .../others/c/bearerAuth/src/apiClient.c | 28 ++++++------------- samples/client/others/c/bearerAuth/src/list.c | 2 +- .../c-useJsonUnformatted/src/apiClient.c | 28 ++++++------------- .../petstore/c-useJsonUnformatted/src/list.c | 2 +- samples/client/petstore/c/src/apiClient.c | 28 ++++++------------- samples/client/petstore/c/src/list.c | 2 +- 8 files changed, 40 insertions(+), 80 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache index 564ca9b16b00..dabdcac9ed3f 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache @@ -286,36 +286,26 @@ void apiClient_invoke(apiClient_t *apiClient, if(headerType != NULL) { list_ForEach(listEntry, headerType) { - if(strstr(listEntry->data, - "xml") == NULL) + if(strstr(listEntry->data, "xml") == NULL) { - buffHeader = malloc(strlen( - "Accept: ") + - strlen(listEntry-> - data) + 1); + buffHeader = malloc(strlen("Accept: ") + + strlen(listEntry->data) + 1); sprintf(buffHeader, "%s%s", "Accept: ", (char *) listEntry->data); - headers = curl_slist_append(headers, - buffHeader); + headers = curl_slist_append(headers, buffHeader); free(buffHeader); } } } if(contentType != NULL) { list_ForEach(listEntry, contentType) { - if(strstr(listEntry->data, - "xml") == NULL) + if(strstr(listEntry->data, "xml") == NULL) { - buffContent = - malloc(strlen( - "Content-Type: ") + strlen( - listEntry->data) + - 1); - sprintf(buffContent, "%s%s", - "Content-Type: ", + buffContent = malloc(strlen("Content-Type: ") + + strlen(listEntry->data) + 1); + sprintf(buffContent, "%s%s", "Content-Type: ", (char *) listEntry->data); - headers = curl_slist_append(headers, - buffContent); + headers = curl_slist_append(headers, buffContent); free(buffContent); buffContent = NULL; } diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/list.c.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/list.c.mustache index 1ce7b969a373..7053ff122dfc 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/list.c.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/list.c.mustache @@ -20,7 +20,7 @@ void listEntry_free(listEntry_t *listEntry, void *additionalData) { } void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) { - printf("%i\n", *((int *) (listEntry->data))); + printf("%i\n", *(int *)listEntry->data); } list_t *list_createList() { diff --git a/samples/client/others/c/bearerAuth/src/apiClient.c b/samples/client/others/c/bearerAuth/src/apiClient.c index d5f4602b175c..1f63b452f474 100644 --- a/samples/client/others/c/bearerAuth/src/apiClient.c +++ b/samples/client/others/c/bearerAuth/src/apiClient.c @@ -202,36 +202,26 @@ void apiClient_invoke(apiClient_t *apiClient, if(headerType != NULL) { list_ForEach(listEntry, headerType) { - if(strstr(listEntry->data, - "xml") == NULL) + if(strstr(listEntry->data, "xml") == NULL) { - buffHeader = malloc(strlen( - "Accept: ") + - strlen(listEntry-> - data) + 1); + buffHeader = malloc(strlen("Accept: ") + + strlen(listEntry->data) + 1); sprintf(buffHeader, "%s%s", "Accept: ", (char *) listEntry->data); - headers = curl_slist_append(headers, - buffHeader); + headers = curl_slist_append(headers, buffHeader); free(buffHeader); } } } if(contentType != NULL) { list_ForEach(listEntry, contentType) { - if(strstr(listEntry->data, - "xml") == NULL) + if(strstr(listEntry->data, "xml") == NULL) { - buffContent = - malloc(strlen( - "Content-Type: ") + strlen( - listEntry->data) + - 1); - sprintf(buffContent, "%s%s", - "Content-Type: ", + buffContent = malloc(strlen("Content-Type: ") + + strlen(listEntry->data) + 1); + sprintf(buffContent, "%s%s", "Content-Type: ", (char *) listEntry->data); - headers = curl_slist_append(headers, - buffContent); + headers = curl_slist_append(headers, buffContent); free(buffContent); buffContent = NULL; } diff --git a/samples/client/others/c/bearerAuth/src/list.c b/samples/client/others/c/bearerAuth/src/list.c index 1ce7b969a373..7053ff122dfc 100644 --- a/samples/client/others/c/bearerAuth/src/list.c +++ b/samples/client/others/c/bearerAuth/src/list.c @@ -20,7 +20,7 @@ void listEntry_free(listEntry_t *listEntry, void *additionalData) { } void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) { - printf("%i\n", *((int *) (listEntry->data))); + printf("%i\n", *(int *)listEntry->data); } list_t *list_createList() { diff --git a/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c b/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c index 94efaba50f2d..6879fbdbbbc4 100644 --- a/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c +++ b/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c @@ -229,36 +229,26 @@ void apiClient_invoke(apiClient_t *apiClient, if(headerType != NULL) { list_ForEach(listEntry, headerType) { - if(strstr(listEntry->data, - "xml") == NULL) + if(strstr(listEntry->data, "xml") == NULL) { - buffHeader = malloc(strlen( - "Accept: ") + - strlen(listEntry-> - data) + 1); + buffHeader = malloc(strlen("Accept: ") + + strlen(listEntry->data) + 1); sprintf(buffHeader, "%s%s", "Accept: ", (char *) listEntry->data); - headers = curl_slist_append(headers, - buffHeader); + headers = curl_slist_append(headers, buffHeader); free(buffHeader); } } } if(contentType != NULL) { list_ForEach(listEntry, contentType) { - if(strstr(listEntry->data, - "xml") == NULL) + if(strstr(listEntry->data, "xml") == NULL) { - buffContent = - malloc(strlen( - "Content-Type: ") + strlen( - listEntry->data) + - 1); - sprintf(buffContent, "%s%s", - "Content-Type: ", + buffContent = malloc(strlen("Content-Type: ") + + strlen(listEntry->data) + 1); + sprintf(buffContent, "%s%s", "Content-Type: ", (char *) listEntry->data); - headers = curl_slist_append(headers, - buffContent); + headers = curl_slist_append(headers, buffContent); free(buffContent); buffContent = NULL; } diff --git a/samples/client/petstore/c-useJsonUnformatted/src/list.c b/samples/client/petstore/c-useJsonUnformatted/src/list.c index 1ce7b969a373..7053ff122dfc 100644 --- a/samples/client/petstore/c-useJsonUnformatted/src/list.c +++ b/samples/client/petstore/c-useJsonUnformatted/src/list.c @@ -20,7 +20,7 @@ void listEntry_free(listEntry_t *listEntry, void *additionalData) { } void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) { - printf("%i\n", *((int *) (listEntry->data))); + printf("%i\n", *(int *)listEntry->data); } list_t *list_createList() { diff --git a/samples/client/petstore/c/src/apiClient.c b/samples/client/petstore/c/src/apiClient.c index 94efaba50f2d..6879fbdbbbc4 100644 --- a/samples/client/petstore/c/src/apiClient.c +++ b/samples/client/petstore/c/src/apiClient.c @@ -229,36 +229,26 @@ void apiClient_invoke(apiClient_t *apiClient, if(headerType != NULL) { list_ForEach(listEntry, headerType) { - if(strstr(listEntry->data, - "xml") == NULL) + if(strstr(listEntry->data, "xml") == NULL) { - buffHeader = malloc(strlen( - "Accept: ") + - strlen(listEntry-> - data) + 1); + buffHeader = malloc(strlen("Accept: ") + + strlen(listEntry->data) + 1); sprintf(buffHeader, "%s%s", "Accept: ", (char *) listEntry->data); - headers = curl_slist_append(headers, - buffHeader); + headers = curl_slist_append(headers, buffHeader); free(buffHeader); } } } if(contentType != NULL) { list_ForEach(listEntry, contentType) { - if(strstr(listEntry->data, - "xml") == NULL) + if(strstr(listEntry->data, "xml") == NULL) { - buffContent = - malloc(strlen( - "Content-Type: ") + strlen( - listEntry->data) + - 1); - sprintf(buffContent, "%s%s", - "Content-Type: ", + buffContent = malloc(strlen("Content-Type: ") + + strlen(listEntry->data) + 1); + sprintf(buffContent, "%s%s", "Content-Type: ", (char *) listEntry->data); - headers = curl_slist_append(headers, - buffContent); + headers = curl_slist_append(headers, buffContent); free(buffContent); buffContent = NULL; } diff --git a/samples/client/petstore/c/src/list.c b/samples/client/petstore/c/src/list.c index 1ce7b969a373..7053ff122dfc 100644 --- a/samples/client/petstore/c/src/list.c +++ b/samples/client/petstore/c/src/list.c @@ -20,7 +20,7 @@ void listEntry_free(listEntry_t *listEntry, void *additionalData) { } void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) { - printf("%i\n", *((int *) (listEntry->data))); + printf("%i\n", *(int *)listEntry->data); } list_t *list_createList() {