Skip to content

Commit

Permalink
[fix #139] Resolve cpp keyword conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
caesar0301 committed Aug 25, 2022
1 parent 9a78e0f commit 7834454
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions kubernetes/config/kube_config_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/config/kube_config_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern "C" {
union {
struct { /* context */
char *cluster;
char *namespace;
char *_namespace;
char *user;
};
struct { /* cluster */
Expand Down
6 changes: 3 additions & 3 deletions kubernetes/config/kube_config_yaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 7834454

Please sign in to comment.