[C-libcurl] Escape parameter name of function when it is the C keyword. (#4838)

This commit is contained in:
Hui Yu 2019-12-19 16:29:56 +08:00 committed by William Cheng
parent 366bfd2a67
commit 5ba67c8c95
2 changed files with 2 additions and 2 deletions

View File

@ -337,7 +337,7 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
@Override
public String toParamName(String name) {
// should be the same as variable name
if (name.matches("^\\d.*")) {
if (isReservedWord(name) || name.matches("^\\d.*")) {
name = escapeReservedWord(name);
}
name = name.replaceAll("-","_");

View File

@ -141,7 +141,7 @@
list_addElement(localVarQueryParameters,{{paramName}});
{{/isListContainer}}
{{^isListContainer}}
keyQuery_{{{paramName}}} = strdup("{{{paramName}}}");
keyQuery_{{{paramName}}} = strdup("{{{baseName}}}");
valueQuery_{{{paramName}}} = {{#isString}}{{^isEnum}}strdup({{/isEnum}}{{/isString}}({{{paramName}}}){{#isString}}{{^isEnum}}){{/isEnum}}{{/isString}};
keyPairQuery_{{paramName}} = keyValuePair_create(keyQuery_{{{paramName}}}, {{#isEnum}}(void *){{/isEnum}}{{^isString}}&{{/isString}}valueQuery_{{{paramName}}});
list_addElement(localVarQueryParameters,keyPairQuery_{{paramName}});