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);
property->cluster = NULL;
}
if (property->namespace) {
free(property->namespace);
property->namespace = NULL;
if (property->_namespace) {
free(property->_namespace);
property->_namespace = NULL;
}
if (property->user) {
free(property->user);

View File

@@ -45,7 +45,7 @@ extern "C" {
union {
struct { /* context */
char *cluster;
char *namespace;
char *_namespace;
char *user;
};
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)) {
property->cluster = strdup(value->data.scalar.value);
} 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)) {
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': '' */
if (property->namespace) {
if (-1 == append_key_stringvalue_to_mapping_node(output_document, map, KEY_NAMESPACE, property->namespace)) {
if (property->_namespace) {
if (-1 == append_key_stringvalue_to_mapping_node(output_document, map, KEY_NAMESPACE, property->_namespace)) {
return -1;
}
}