Skip to content

Commit

Permalink
[C][Client] Cosmetic: remove unnecessary parens, align some lines
Browse files Browse the repository at this point in the history
  • Loading branch information
imaami committed Jan 8, 2025
1 parent 6f2fdab commit 42516f6
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
28 changes: 9 additions & 19 deletions samples/client/others/c/bearerAuth/src/apiClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion samples/client/others/c/bearerAuth/src/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
28 changes: 9 additions & 19 deletions samples/client/petstore/c-useJsonUnformatted/src/apiClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/c-useJsonUnformatted/src/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
28 changes: 9 additions & 19 deletions samples/client/petstore/c/src/apiClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/c/src/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 42516f6

Please sign in to comment.