Skip to content

Commit

Permalink
Merge pull request #162 from ityuhui/yh-string-null-1229
Browse files Browse the repository at this point in the history
Allow cJSON_IsNull() if the string is not mandatory
  • Loading branch information
k8s-ci-robot committed Dec 29, 2022
2 parents 3a13070 + c740f06 commit c14ef1f
Show file tree
Hide file tree
Showing 308 changed files with 1,331 additions and 1,331 deletions.
2 changes: 1 addition & 1 deletion kubernetes/external/cJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ typedef struct internal_hooks
} internal_hooks;

#if defined(_MSC_VER)
/* work around MSVC error C2322: '...' address of dillimport '...' is not static */
/* work around MSVC error C2322: '...' address of dllimport '...' is not static */
static void *internal_malloc(size_t size)
{
return malloc(size);
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/model/admissionregistration_v1_service_reference.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ admissionregistration_v1_service_reference_t *admissionregistration_v1_service_r
// admissionregistration_v1_service_reference->path
cJSON *path = cJSON_GetObjectItemCaseSensitive(admissionregistration_v1_service_referenceJSON, "path");
if (path) {
if(!cJSON_IsString(path))
if(!cJSON_IsString(path) && !cJSON_IsNull(path))
{
goto end; //String
}
Expand All @@ -138,7 +138,7 @@ admissionregistration_v1_service_reference_t *admissionregistration_v1_service_r
admissionregistration_v1_service_reference_local_var = admissionregistration_v1_service_reference_create (
strdup(name->valuestring),
strdup(_namespace->valuestring),
path ? strdup(path->valuestring) : NULL,
path && !cJSON_IsNull(path) ? strdup(path->valuestring) : NULL,
port ? port->valuedouble : 0
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ admissionregistration_v1_webhook_client_config_t *admissionregistration_v1_webho
// admissionregistration_v1_webhook_client_config->url
cJSON *url = cJSON_GetObjectItemCaseSensitive(admissionregistration_v1_webhook_client_configJSON, "url");
if (url) {
if(!cJSON_IsString(url))
if(!cJSON_IsString(url) && !cJSON_IsNull(url))
{
goto end; //String
}
Expand All @@ -116,7 +116,7 @@ admissionregistration_v1_webhook_client_config_t *admissionregistration_v1_webho
admissionregistration_v1_webhook_client_config_local_var = admissionregistration_v1_webhook_client_config_create (
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
service ? service_local_nonprim : NULL,
url ? strdup(url->valuestring) : NULL
url && !cJSON_IsNull(url) ? strdup(url->valuestring) : NULL
);

return admissionregistration_v1_webhook_client_config_local_var;
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/model/apiextensions_v1_service_reference.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ apiextensions_v1_service_reference_t *apiextensions_v1_service_reference_parseFr
// apiextensions_v1_service_reference->path
cJSON *path = cJSON_GetObjectItemCaseSensitive(apiextensions_v1_service_referenceJSON, "path");
if (path) {
if(!cJSON_IsString(path))
if(!cJSON_IsString(path) && !cJSON_IsNull(path))
{
goto end; //String
}
Expand All @@ -138,7 +138,7 @@ apiextensions_v1_service_reference_t *apiextensions_v1_service_reference_parseFr
apiextensions_v1_service_reference_local_var = apiextensions_v1_service_reference_create (
strdup(name->valuestring),
strdup(_namespace->valuestring),
path ? strdup(path->valuestring) : NULL,
path && !cJSON_IsNull(path) ? strdup(path->valuestring) : NULL,
port ? port->valuedouble : 0
);

Expand Down
4 changes: 2 additions & 2 deletions kubernetes/model/apiextensions_v1_webhook_client_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ apiextensions_v1_webhook_client_config_t *apiextensions_v1_webhook_client_config
// apiextensions_v1_webhook_client_config->url
cJSON *url = cJSON_GetObjectItemCaseSensitive(apiextensions_v1_webhook_client_configJSON, "url");
if (url) {
if(!cJSON_IsString(url))
if(!cJSON_IsString(url) && !cJSON_IsNull(url))
{
goto end; //String
}
Expand All @@ -116,7 +116,7 @@ apiextensions_v1_webhook_client_config_t *apiextensions_v1_webhook_client_config
apiextensions_v1_webhook_client_config_local_var = apiextensions_v1_webhook_client_config_create (
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
service ? service_local_nonprim : NULL,
url ? strdup(url->valuestring) : NULL
url && !cJSON_IsNull(url) ? strdup(url->valuestring) : NULL
);

return apiextensions_v1_webhook_client_config_local_var;
Expand Down
8 changes: 4 additions & 4 deletions kubernetes/model/apiregistration_v1_service_reference.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ apiregistration_v1_service_reference_t *apiregistration_v1_service_reference_par
// apiregistration_v1_service_reference->name
cJSON *name = cJSON_GetObjectItemCaseSensitive(apiregistration_v1_service_referenceJSON, "name");
if (name) {
if(!cJSON_IsString(name))
if(!cJSON_IsString(name) && !cJSON_IsNull(name))
{
goto end; //String
}
Expand All @@ -88,7 +88,7 @@ apiregistration_v1_service_reference_t *apiregistration_v1_service_reference_par
// apiregistration_v1_service_reference->_namespace
cJSON *_namespace = cJSON_GetObjectItemCaseSensitive(apiregistration_v1_service_referenceJSON, "namespace");
if (_namespace) {
if(!cJSON_IsString(_namespace))
if(!cJSON_IsString(_namespace) && !cJSON_IsNull(_namespace))
{
goto end; //String
}
Expand All @@ -105,8 +105,8 @@ apiregistration_v1_service_reference_t *apiregistration_v1_service_reference_par


apiregistration_v1_service_reference_local_var = apiregistration_v1_service_reference_create (
name ? strdup(name->valuestring) : NULL,
_namespace ? strdup(_namespace->valuestring) : NULL,
name && !cJSON_IsNull(name) ? strdup(name->valuestring) : NULL,
_namespace && !cJSON_IsNull(_namespace) ? strdup(_namespace->valuestring) : NULL,
port ? port->valuedouble : 0
);

Expand Down
8 changes: 4 additions & 4 deletions kubernetes/model/authentication_v1_token_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ authentication_v1_token_request_t *authentication_v1_token_request_parseFromJSON
// authentication_v1_token_request->api_version
cJSON *api_version = cJSON_GetObjectItemCaseSensitive(authentication_v1_token_requestJSON, "apiVersion");
if (api_version) {
if(!cJSON_IsString(api_version))
if(!cJSON_IsString(api_version) && !cJSON_IsNull(api_version))
{
goto end; //String
}
Expand All @@ -145,7 +145,7 @@ authentication_v1_token_request_t *authentication_v1_token_request_parseFromJSON
// authentication_v1_token_request->kind
cJSON *kind = cJSON_GetObjectItemCaseSensitive(authentication_v1_token_requestJSON, "kind");
if (kind) {
if(!cJSON_IsString(kind))
if(!cJSON_IsString(kind) && !cJSON_IsNull(kind))
{
goto end; //String
}
Expand Down Expand Up @@ -174,8 +174,8 @@ authentication_v1_token_request_t *authentication_v1_token_request_parseFromJSON


authentication_v1_token_request_local_var = authentication_v1_token_request_create (
api_version ? strdup(api_version->valuestring) : NULL,
kind ? strdup(kind->valuestring) : NULL,
api_version && !cJSON_IsNull(api_version) ? strdup(api_version->valuestring) : NULL,
kind && !cJSON_IsNull(kind) ? strdup(kind->valuestring) : NULL,
metadata ? metadata_local_nonprim : NULL,
spec_local_nonprim,
status ? status_local_nonprim : NULL
Expand Down
12 changes: 6 additions & 6 deletions kubernetes/model/core_v1_endpoint_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ core_v1_endpoint_port_t *core_v1_endpoint_port_parseFromJSON(cJSON *core_v1_endp
// core_v1_endpoint_port->app_protocol
cJSON *app_protocol = cJSON_GetObjectItemCaseSensitive(core_v1_endpoint_portJSON, "appProtocol");
if (app_protocol) {
if(!cJSON_IsString(app_protocol))
if(!cJSON_IsString(app_protocol) && !cJSON_IsNull(app_protocol))
{
goto end; //String
}
Expand All @@ -103,7 +103,7 @@ core_v1_endpoint_port_t *core_v1_endpoint_port_parseFromJSON(cJSON *core_v1_endp
// core_v1_endpoint_port->name
cJSON *name = cJSON_GetObjectItemCaseSensitive(core_v1_endpoint_portJSON, "name");
if (name) {
if(!cJSON_IsString(name))
if(!cJSON_IsString(name) && !cJSON_IsNull(name))
{
goto end; //String
}
Expand All @@ -124,18 +124,18 @@ core_v1_endpoint_port_t *core_v1_endpoint_port_parseFromJSON(cJSON *core_v1_endp
// core_v1_endpoint_port->protocol
cJSON *protocol = cJSON_GetObjectItemCaseSensitive(core_v1_endpoint_portJSON, "protocol");
if (protocol) {
if(!cJSON_IsString(protocol))
if(!cJSON_IsString(protocol) && !cJSON_IsNull(protocol))
{
goto end; //String
}
}


core_v1_endpoint_port_local_var = core_v1_endpoint_port_create (
app_protocol ? strdup(app_protocol->valuestring) : NULL,
name ? strdup(name->valuestring) : NULL,
app_protocol && !cJSON_IsNull(app_protocol) ? strdup(app_protocol->valuestring) : NULL,
name && !cJSON_IsNull(name) ? strdup(name->valuestring) : NULL,
port->valuedouble,
protocol ? strdup(protocol->valuestring) : NULL
protocol && !cJSON_IsNull(protocol) ? strdup(protocol->valuestring) : NULL
);

return core_v1_endpoint_port_local_var;
Expand Down
32 changes: 16 additions & 16 deletions kubernetes/model/core_v1_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ core_v1_event_t *core_v1_event_parseFromJSON(cJSON *core_v1_eventJSON){
// core_v1_event->action
cJSON *action = cJSON_GetObjectItemCaseSensitive(core_v1_eventJSON, "action");
if (action) {
if(!cJSON_IsString(action))
if(!cJSON_IsString(action) && !cJSON_IsNull(action))
{
goto end; //String
}
Expand All @@ -326,7 +326,7 @@ core_v1_event_t *core_v1_event_parseFromJSON(cJSON *core_v1_eventJSON){
// core_v1_event->api_version
cJSON *api_version = cJSON_GetObjectItemCaseSensitive(core_v1_eventJSON, "apiVersion");
if (api_version) {
if(!cJSON_IsString(api_version))
if(!cJSON_IsString(api_version) && !cJSON_IsNull(api_version))
{
goto end; //String
}
Expand Down Expand Up @@ -371,7 +371,7 @@ core_v1_event_t *core_v1_event_parseFromJSON(cJSON *core_v1_eventJSON){
// core_v1_event->kind
cJSON *kind = cJSON_GetObjectItemCaseSensitive(core_v1_eventJSON, "kind");
if (kind) {
if(!cJSON_IsString(kind))
if(!cJSON_IsString(kind) && !cJSON_IsNull(kind))
{
goto end; //String
}
Expand All @@ -389,7 +389,7 @@ core_v1_event_t *core_v1_event_parseFromJSON(cJSON *core_v1_eventJSON){
// core_v1_event->message
cJSON *message = cJSON_GetObjectItemCaseSensitive(core_v1_eventJSON, "message");
if (message) {
if(!cJSON_IsString(message))
if(!cJSON_IsString(message) && !cJSON_IsNull(message))
{
goto end; //String
}
Expand All @@ -407,7 +407,7 @@ core_v1_event_t *core_v1_event_parseFromJSON(cJSON *core_v1_eventJSON){
// core_v1_event->reason
cJSON *reason = cJSON_GetObjectItemCaseSensitive(core_v1_eventJSON, "reason");
if (reason) {
if(!cJSON_IsString(reason))
if(!cJSON_IsString(reason) && !cJSON_IsNull(reason))
{
goto end; //String
}
Expand All @@ -422,7 +422,7 @@ core_v1_event_t *core_v1_event_parseFromJSON(cJSON *core_v1_eventJSON){
// core_v1_event->reporting_component
cJSON *reporting_component = cJSON_GetObjectItemCaseSensitive(core_v1_eventJSON, "reportingComponent");
if (reporting_component) {
if(!cJSON_IsString(reporting_component))
if(!cJSON_IsString(reporting_component) && !cJSON_IsNull(reporting_component))
{
goto end; //String
}
Expand All @@ -431,7 +431,7 @@ core_v1_event_t *core_v1_event_parseFromJSON(cJSON *core_v1_eventJSON){
// core_v1_event->reporting_instance
cJSON *reporting_instance = cJSON_GetObjectItemCaseSensitive(core_v1_eventJSON, "reportingInstance");
if (reporting_instance) {
if(!cJSON_IsString(reporting_instance))
if(!cJSON_IsString(reporting_instance) && !cJSON_IsNull(reporting_instance))
{
goto end; //String
}
Expand All @@ -452,31 +452,31 @@ core_v1_event_t *core_v1_event_parseFromJSON(cJSON *core_v1_eventJSON){
// core_v1_event->type
cJSON *type = cJSON_GetObjectItemCaseSensitive(core_v1_eventJSON, "type");
if (type) {
if(!cJSON_IsString(type))
if(!cJSON_IsString(type) && !cJSON_IsNull(type))
{
goto end; //String
}
}


core_v1_event_local_var = core_v1_event_create (
action ? strdup(action->valuestring) : NULL,
api_version ? strdup(api_version->valuestring) : NULL,
action && !cJSON_IsNull(action) ? strdup(action->valuestring) : NULL,
api_version && !cJSON_IsNull(api_version) ? strdup(api_version->valuestring) : NULL,
count ? count->valuedouble : 0,
event_time && !cJSON_IsNull(event_time) ? strdup(event_time->valuestring) : NULL,
first_timestamp && !cJSON_IsNull(first_timestamp) ? strdup(first_timestamp->valuestring) : NULL,
involved_object_local_nonprim,
kind ? strdup(kind->valuestring) : NULL,
kind && !cJSON_IsNull(kind) ? strdup(kind->valuestring) : NULL,
last_timestamp && !cJSON_IsNull(last_timestamp) ? strdup(last_timestamp->valuestring) : NULL,
message ? strdup(message->valuestring) : NULL,
message && !cJSON_IsNull(message) ? strdup(message->valuestring) : NULL,
metadata_local_nonprim,
reason ? strdup(reason->valuestring) : NULL,
reason && !cJSON_IsNull(reason) ? strdup(reason->valuestring) : NULL,
related ? related_local_nonprim : NULL,
reporting_component ? strdup(reporting_component->valuestring) : NULL,
reporting_instance ? strdup(reporting_instance->valuestring) : NULL,
reporting_component && !cJSON_IsNull(reporting_component) ? strdup(reporting_component->valuestring) : NULL,
reporting_instance && !cJSON_IsNull(reporting_instance) ? strdup(reporting_instance->valuestring) : NULL,
series ? series_local_nonprim : NULL,
source ? source_local_nonprim : NULL,
type ? strdup(type->valuestring) : NULL
type && !cJSON_IsNull(type) ? strdup(type->valuestring) : NULL
);

return core_v1_event_local_var;
Expand Down
8 changes: 4 additions & 4 deletions kubernetes/model/core_v1_event_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ core_v1_event_list_t *core_v1_event_list_parseFromJSON(cJSON *core_v1_event_list
// core_v1_event_list->api_version
cJSON *api_version = cJSON_GetObjectItemCaseSensitive(core_v1_event_listJSON, "apiVersion");
if (api_version) {
if(!cJSON_IsString(api_version))
if(!cJSON_IsString(api_version) && !cJSON_IsNull(api_version))
{
goto end; //String
}
Expand Down Expand Up @@ -157,7 +157,7 @@ core_v1_event_list_t *core_v1_event_list_parseFromJSON(cJSON *core_v1_event_list
// core_v1_event_list->kind
cJSON *kind = cJSON_GetObjectItemCaseSensitive(core_v1_event_listJSON, "kind");
if (kind) {
if(!cJSON_IsString(kind))
if(!cJSON_IsString(kind) && !cJSON_IsNull(kind))
{
goto end; //String
}
Expand All @@ -171,9 +171,9 @@ core_v1_event_list_t *core_v1_event_list_parseFromJSON(cJSON *core_v1_event_list


core_v1_event_list_local_var = core_v1_event_list_create (
api_version ? strdup(api_version->valuestring) : NULL,
api_version && !cJSON_IsNull(api_version) ? strdup(api_version->valuestring) : NULL,
itemsList,
kind ? strdup(kind->valuestring) : NULL,
kind && !cJSON_IsNull(kind) ? strdup(kind->valuestring) : NULL,
metadata ? metadata_local_nonprim : NULL
);

Expand Down
12 changes: 6 additions & 6 deletions kubernetes/model/discovery_v1_endpoint_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ discovery_v1_endpoint_port_t *discovery_v1_endpoint_port_parseFromJSON(cJSON *di
// discovery_v1_endpoint_port->app_protocol
cJSON *app_protocol = cJSON_GetObjectItemCaseSensitive(discovery_v1_endpoint_portJSON, "appProtocol");
if (app_protocol) {
if(!cJSON_IsString(app_protocol))
if(!cJSON_IsString(app_protocol) && !cJSON_IsNull(app_protocol))
{
goto end; //String
}
Expand All @@ -102,7 +102,7 @@ discovery_v1_endpoint_port_t *discovery_v1_endpoint_port_parseFromJSON(cJSON *di
// discovery_v1_endpoint_port->name
cJSON *name = cJSON_GetObjectItemCaseSensitive(discovery_v1_endpoint_portJSON, "name");
if (name) {
if(!cJSON_IsString(name))
if(!cJSON_IsString(name) && !cJSON_IsNull(name))
{
goto end; //String
}
Expand All @@ -120,18 +120,18 @@ discovery_v1_endpoint_port_t *discovery_v1_endpoint_port_parseFromJSON(cJSON *di
// discovery_v1_endpoint_port->protocol
cJSON *protocol = cJSON_GetObjectItemCaseSensitive(discovery_v1_endpoint_portJSON, "protocol");
if (protocol) {
if(!cJSON_IsString(protocol))
if(!cJSON_IsString(protocol) && !cJSON_IsNull(protocol))
{
goto end; //String
}
}


discovery_v1_endpoint_port_local_var = discovery_v1_endpoint_port_create (
app_protocol ? strdup(app_protocol->valuestring) : NULL,
name ? strdup(name->valuestring) : NULL,
app_protocol && !cJSON_IsNull(app_protocol) ? strdup(app_protocol->valuestring) : NULL,
name && !cJSON_IsNull(name) ? strdup(name->valuestring) : NULL,
port ? port->valuedouble : 0,
protocol ? strdup(protocol->valuestring) : NULL
protocol && !cJSON_IsNull(protocol) ? strdup(protocol->valuestring) : NULL
);

return discovery_v1_endpoint_port_local_var;
Expand Down
Loading

0 comments on commit c14ef1f

Please sign in to comment.