Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyword conflict with zebos list_creat(), list_free() #11190

Merged
merged 2 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,9 @@ public String toExampleValue(Schema schema) {
} else if (ModelUtils.isBooleanSchema(schema)) {
example = "1";
} else if (ModelUtils.isArraySchema(schema)) {
example = "list_create()";
example = "list_createList()";
} else if (ModelUtils.isMapSchema(schema)) {
example = "list_create()";
example = "list_createList()";
} else if (ModelUtils.isObjectSchema(schema)) {
return null; // models are managed at moustache level
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ end:
{{#returnType}}{{#returnTypeIsPrimitive}}{{#returnSimpleType}}{{{.}}}*{{/returnSimpleType}}{{^returnSimpleType}}{{#isArray}}{{{.}}}_t*{{/isArray}}{{#isMap}}{{{.}}}{{/isMap}}{{/returnSimpleType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{{.}}}_t*{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void{{/returnType}}
{{{classname}}}_{{{operationId}}}(apiClient_t *apiClient{{#allParams}}, {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}} *{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{#isFreeFormObject}}{{dataType}}_t *{{/isFreeFormObject}}{{/isPrimitiveType}}{{^isArray}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}}{{/isArray}}{{#isContainer}}{{#isArray}}{{dataType}}_t *{{/isArray}}{{#isMap}}{{dataType}}{{/isMap}}{{/isContainer}} {{{paramName}}} {{/allParams}})
{
list_t *localVarQueryParameters = {{#hasQueryParams}}list_create();{{/hasQueryParams}}{{^hasQueryParams}}NULL;{{/hasQueryParams}}
list_t *localVarHeaderParameters = {{#hasHeaderParams}}list_create();{{/hasHeaderParams}}{{^hasHeaderParams}}NULL;{{/hasHeaderParams}}
list_t *localVarFormParameters = {{#hasFormParams}}list_create();{{/hasFormParams}}{{^hasFormParams}}NULL;{{/hasFormParams}}
list_t *localVarHeaderType = {{#hasProduces}}list_create();{{/hasProduces}}{{^hasProduces}}NULL;{{/hasProduces}}
list_t *localVarContentType = {{#hasConsumes}}list_create();{{/hasConsumes}}{{^hasConsumes}}NULL;{{/hasConsumes}}
list_t *localVarQueryParameters = {{#hasQueryParams}}list_createList();{{/hasQueryParams}}{{^hasQueryParams}}NULL;{{/hasQueryParams}}
list_t *localVarHeaderParameters = {{#hasHeaderParams}}list_createList();{{/hasHeaderParams}}{{^hasHeaderParams}}NULL;{{/hasHeaderParams}}
list_t *localVarFormParameters = {{#hasFormParams}}list_createList();{{/hasFormParams}}{{^hasFormParams}}NULL;{{/hasFormParams}}
list_t *localVarHeaderType = {{#hasProduces}}list_createList();{{/hasProduces}}{{^hasProduces}}NULL;{{/hasProduces}}
list_t *localVarContentType = {{#hasConsumes}}list_createList();{{/hasConsumes}}{{^hasConsumes}}NULL;{{/hasConsumes}}
char *localVarBodyParameters = NULL;

// create the path
Expand Down Expand Up @@ -341,7 +341,7 @@ end:
//primitive return type not simple
cJSON *{{paramName}}localVarJSON = cJSON_Parse(apiClient->dataReceived);
cJSON *{{{paramName}}}VarJSON;
list_t *elementToReturn = list_create();
list_t *elementToReturn = list_createList();
cJSON_ArrayForEach({{{paramName}}}VarJSON, {{paramName}}localVarJSON){
keyValuePair_t *keyPair = keyValuePair_create(strdup({{{paramName}}}VarJSON->string), cJSON_Print({{{paramName}}}VarJSON));
list_addElement(elementToReturn, keyPair);
Expand All @@ -356,7 +356,7 @@ end:
if(!cJSON_IsArray({{classname}}localVarJSON)) {
return 0;//nonprimitive container
}
list_t *elementToReturn = list_create();
list_t *elementToReturn = list_createList();
cJSON *{{{paramName}}}VarJSON;
cJSON_ArrayForEach({{{paramName}}}VarJSON, {{classname}}localVarJSON)
{
Expand Down Expand Up @@ -388,11 +388,11 @@ end:
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
}
{{#hasQueryParams}}list_free(localVarQueryParameters);{{/hasQueryParams}}
{{#hasHeaderParams}}list_free(localVarHeaderParameters);{{/hasHeaderParams}}
{{#hasFormParams}}list_free(localVarFormParameters);{{/hasFormParams}}
{{#hasProduces}}list_free(localVarHeaderType);{{/hasProduces}}
{{#hasConsumes}}list_free(localVarContentType);{{/hasConsumes}}
{{#hasQueryParams}}list_freeList(localVarQueryParameters);{{/hasQueryParams}}
{{#hasHeaderParams}}list_freeList(localVarHeaderParameters);{{/hasHeaderParams}}
{{#hasFormParams}}list_freeList(localVarFormParameters);{{/hasFormParams}}
{{#hasProduces}}list_freeList(localVarHeaderType);{{/hasProduces}}
{{#hasConsumes}}list_freeList(localVarContentType);{{/hasConsumes}}
free(localVarPath);
{{#pathParams}}
free(localVarToReplace_{{paramName}});
Expand Down Expand Up @@ -526,11 +526,11 @@ end:
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
}
{{#hasQueryParams}}list_free(localVarQueryParameters);{{/hasQueryParams}}
{{#hasHeaderParams}}list_free(localVarHeaderParameters);{{/hasHeaderParams}}
{{#hasFormParams}}list_free(localVarFormParameters);{{/hasFormParams}}
{{#hasProduces}}list_free(localVarHeaderType);{{/hasProduces}}
{{#hasConsumes}}list_free(localVarContentType);{{/hasConsumes}}
{{#hasQueryParams}}list_freeList(localVarQueryParameters);{{/hasQueryParams}}
{{#hasHeaderParams}}list_freeList(localVarHeaderParameters);{{/hasHeaderParams}}
{{#hasFormParams}}list_freeList(localVarFormParameters);{{/hasFormParams}}
{{#hasProduces}}list_freeList(localVarHeaderType);{{/hasProduces}}
{{#hasConsumes}}list_freeList(localVarContentType);{{/hasConsumes}}
free(localVarPath);
{{#pathParams}}
free(localVarToReplace_{{paramName}});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ apiClient_t *apiClient_create_with_base_path(const char *basePath
{{/isOAuth}}
{{#isApiKey}}
if(apiKeys_{{name}}!= NULL) {
apiClient->apiKeys_{{name}} = list_create();
apiClient->apiKeys_{{name}} = list_createList();
listEntry_t *listEntry = NULL;
list_ForEach(listEntry, apiKeys_{{name}}) {
keyValuePair_t *pair = listEntry->data;
Expand Down Expand Up @@ -126,7 +126,7 @@ void apiClient_free(apiClient_t *apiClient) {
}
keyValuePair_free(pair);
}
list_free(apiClient->apiKeys_{{name}});
list_freeList(apiClient->apiKeys_{{name}});
}
{{/isApiKey}}
{{/authMethods}}
Expand Down Expand Up @@ -530,7 +530,7 @@ void apiClient_invoke(apiClient_t *apiClient,

res = curl_easy_perform(handle);

curl_slist_free_all(headers);
curl_slist_freeList_all(headers);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think curl_slist_free_all should be modified because it is a function of libcurl https://curl.se/libcurl/c/curl_slist_free_all.html

@minerba
please create a new PR to rollback these changes for curl_slist_free_all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ityuhui
Ok I will create a new PR soon.


free(targetUrl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main() {
char *exampleUrl2 = malloc(strlen(EXAMPLE_URL_2) + 1);
strcpy(exampleUrl2, EXAMPLE_URL_2);

list_t *photoUrls = list_create();
list_t *photoUrls = list_createList();

list_addElement(photoUrls, exampleUrl1);
list_addElement(photoUrls, exampleUrl2);
Expand All @@ -55,7 +55,7 @@ int main() {
strcpy(exampleTag2Name, EXAMPLE_TAG_2_NAME);
tag_t *exampleTag2 = tag_create(EXAMPLE_TAG_2_ID, exampleTag2Name);

list_t *tags = list_create();
list_t *tags = list_createList();

list_addElement(tags, exampleTag1);
list_addElement(tags, exampleTag2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ int main() {
list_ForEach(listEntry, elementToReturn) {
keyValuePair_free(listEntry->data);
}
list_free(elementToReturn);
list_freeList(elementToReturn);

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
printf("%i\n", *((int *) (listEntry->data)));
}

list_t *list_create() {
list_t *list_createList() {
list_t *createdList = malloc(sizeof(list_t));
if(createdList == NULL) {
// TODO Malloc Failure
Expand Down Expand Up @@ -88,7 +88,7 @@ void list_iterateThroughListBackward(list_t *list,
}
}

void list_free(list_t *list) {
void list_freeList(list_t *list) {
if(list){
list_iterateThroughListForward(list, listEntry_free, NULL);
free(list);
Expand Down Expand Up @@ -196,5 +196,5 @@ void clear_and_free_string_list(list_t *list)
free(list_item);
list_item = NULL;
}
list_free(list);
list_freeList(list);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ typedef struct list_t {

#define list_ForEach(element, list) for(element = (list != NULL) ? (list)->firstEntry : NULL; element != NULL; element = element->nextListEntry)

list_t* list_create();
void list_free(list_t* listToFree);
list_t* List();
void list_freeListList(list_t* listToFree);

minerba marked this conversation as resolved.
Show resolved Hide resolved
void list_addElement(list_t* list, void* dataToAddInList);
listEntry_t* list_getElementAt(list_t *list, long indexOfElement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void {{classname}}_free({{classname}}_t *{{classname}}) {
list_ForEach(listEntry, {{classname}}->{{name}}) {
free(listEntry->data);
}
list_free({{classname}}->{{name}});
list_freeList({{classname}}->{{name}});
{{classname}}->{{name}} = NULL;
}
{{/isPrimitiveType}}
Expand All @@ -303,7 +303,7 @@ void {{classname}}_free({{classname}}_t *{{classname}}) {
list_ForEach(listEntry, {{classname}}->{{name}}) {
{{complexType}}_free(listEntry->data);
}
list_free({{classname}}->{{name}});
list_freeList({{classname}}->{{name}});
{{classname}}->{{name}} = NULL;
}
{{/isPrimitiveType}}
Expand All @@ -316,7 +316,7 @@ void {{classname}}_free({{classname}}_t *{{classname}}) {
free (localKeyValue->value);
keyValuePair_free(localKeyValue);
}
list_free({{classname}}->{{name}});
list_freeList({{classname}}->{{name}});
{{classname}}->{{name}} = NULL;
}
{{/isMap}}
Expand Down Expand Up @@ -699,7 +699,7 @@ fail:
if(!cJSON_IsArray({{{name}}})) {
goto end;//primitive container
}
{{{name}}}List = list_create();
{{{name}}}List = list_createList();

cJSON_ArrayForEach({{{name}}}_local, {{{name}}})
{
Expand Down Expand Up @@ -742,7 +742,7 @@ fail:
goto end; //nonprimitive container
}

{{{name}}}List = list_create();
{{{name}}}List = list_createList();

cJSON_ArrayForEach({{{name}}}_local_nonprimitive,{{{name}}} )
{
Expand All @@ -762,7 +762,7 @@ fail:
if(!cJSON_IsObject({{{name}}})) {
goto end;//primitive map container
}
{{{name}}}List = list_create();
{{{name}}}List = list_createList();
keyValuePair_t *localMapKeyPair;
cJSON_ArrayForEach({{{name}}}_local_map, {{{name}}})
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static bool {{nickname}}Helper(char * accessToken,
mBody, headerList, p_chunk, &code, errormsg);
bool retval = {{nickname}}Processor(*p_chunk, code, errormsg, userData,reinterpret_cast<void(*)()>(handler));

curl_slist_free_all(headerList);
curl_slist_freeList_all(headerList);
if (p_chunk) {
if(p_chunk->memory) {
free(p_chunk->memory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public:

~RequestInfo()
{
curl_slist_free_all(headerList);
curl_slist_freeList_all(headerList);
if (this->p_chunk) {
if((this->p_chunk)->memory) {
free((this->p_chunk)->memory);
Expand Down
Loading