Merge pull request #140 from caesar0301/master

Resolve cpp keyword conflict
This commit is contained in:
Kubernetes Prow Robot
2022-08-26 01:06:25 -07:00
committed by GitHub
3 changed files with 7 additions and 7 deletions

View File

@@ -102,9 +102,9 @@ void kubeconfig_property_free(kubeconfig_property_t * property)
free(property->cluster); free(property->cluster);
property->cluster = NULL; property->cluster = NULL;
} }
if (property->namespace) { if (property->_namespace) {
free(property->namespace); free(property->_namespace);
property->namespace = NULL; property->_namespace = NULL;
} }
if (property->user) { if (property->user) {
free(property->user); free(property->user);

View File

@@ -45,7 +45,7 @@ extern "C" {
union { union {
struct { /* context */ struct { /* context */
char *cluster; char *cluster;
char *namespace; char *_namespace;
char *user; char *user;
}; };
struct { /* cluster */ struct { /* cluster */

View File

@@ -202,7 +202,7 @@ static int parse_kubeconfig_yaml_property_mapping(kubeconfig_property_t * proper
if (0 == strcmp(key->data.scalar.value, KEY_CLUSTER)) { if (0 == strcmp(key->data.scalar.value, KEY_CLUSTER)) {
property->cluster = strdup(value->data.scalar.value); property->cluster = strdup(value->data.scalar.value);
} else if (0 == strcmp(key->data.scalar.value, KEY_NAMESPACE)) { } else if (0 == strcmp(key->data.scalar.value, KEY_NAMESPACE)) {
property->namespace = strdup(value->data.scalar.value); property->_namespace = strdup(value->data.scalar.value);
} else if (0 == strcmp(key->data.scalar.value, KEY_USER)) { } else if (0 == strcmp(key->data.scalar.value, KEY_USER)) {
property->user = strdup(value->data.scalar.value); property->user = strdup(value->data.scalar.value);
} }
@@ -802,8 +802,8 @@ static int append_key_map_to_mapping_node(yaml_document_t * output_document, int
} }
/* Add 'namespace': '' */ /* Add 'namespace': '' */
if (property->namespace) { if (property->_namespace) {
if (-1 == append_key_stringvalue_to_mapping_node(output_document, map, KEY_NAMESPACE, property->namespace)) { if (-1 == append_key_stringvalue_to_mapping_node(output_document, map, KEY_NAMESPACE, property->_namespace)) {
return -1; return -1;
} }
} }