From 84ca277aa92a0ec8fa31ff850cf4f6dc48009db6 Mon Sep 17 00:00:00 2001 From: Hui Yu Date: Wed, 9 Mar 2022 14:09:10 +0800 Subject: [PATCH] Update create/free list function names due to changes in generated code --- examples/configmap/main.c | 2 +- examples/create_pod/main.c | 10 +++++----- examples/generic/main.c | 4 ++-- examples/multi_thread/create_pod.c | 10 +++++----- .../authn_plugin/plugins/oidc/libkubernetes_oidc.c | 4 ++-- kubernetes/config/incluster_config.c | 2 +- kubernetes/config/kube_config.c | 2 +- kubernetes/config/kube_config_util.c | 2 +- kubernetes/watch/watch_util.c | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/configmap/main.c b/examples/configmap/main.c index 6f8aabf..a5965f3 100644 --- a/examples/configmap/main.c +++ b/examples/configmap/main.c @@ -11,7 +11,7 @@ void create_configmap(apiClient_t * apiClient, char *name, char *namespace_) char *api_version = strdup("v1"); char *kind = strdup("ConfigMap"); - list_t *data = list_create(); + list_t *data = list_createList(); keyValuePair_t *kv = keyValuePair_create(strdup("worker1"), strdup("1")); list_addElement(data, kv); kv = keyValuePair_create(strdup("worker2"), strdup("2")); diff --git a/examples/create_pod/main.c b/examples/create_pod/main.c index e44dcf2..f31de61 100644 --- a/examples/create_pod/main.c +++ b/examples/create_pod/main.c @@ -19,25 +19,25 @@ void create_a_pod(apiClient_t * apiClient) podinfo->metadata->name = strdup("test-pod-6"); /* set containers for pod */ - list_t *containerlist = list_create(); + list_t *containerlist = list_createList(); v1_container_t *con = calloc(1, sizeof(v1_container_t)); con->name = strdup("my-container"); con->image = strdup("ubuntu:latest"); con->image_pull_policy = strdup("IfNotPresent"); /* set command for container */ - list_t *commandlist = list_create(); + list_t *commandlist = list_createList(); char *cmd = strdup("sleep"); list_addElement(commandlist, cmd); con->command = commandlist; - list_t *arglist = list_create(); + list_t *arglist = list_createList(); char *arg1 = strdup("3600"); list_addElement(arglist, arg1); con->args = arglist; /* set volume mounts for container */ - list_t *volumemounts = list_create(); + list_t *volumemounts = list_createList(); v1_volume_mount_t *volmou = calloc(1, sizeof(v1_volume_mount_t)); volmou->mount_path = strdup("/test"); volmou->name = strdup("test"); @@ -48,7 +48,7 @@ void create_a_pod(apiClient_t * apiClient) podinfo->spec->containers = containerlist; /* set volumes for pod */ - list_t *volumelist = list_create(); + list_t *volumelist = list_createList(); v1_volume_t *volume = calloc(1, sizeof(v1_volume_t)); volume->name = strdup("test"); diff --git a/examples/generic/main.c b/examples/generic/main.c index 4f56290..2984bcc 100644 --- a/examples/generic/main.c +++ b/examples/generic/main.c @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) free(update); const char *patchBody = "[{\"op\": \"replace\", \"path\": \"/metadata/labels/foo\", \"value\": \"qux\" }]"; - list_t *contentType = list_create(); + list_t *contentType = list_createList(); // Kubernetes supports multiple content types: list_addElement(contentType, "application/json-patch+json"); // list_addElement(contentType, "application/merge-patch+json"); @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) // list_addElement(contentType, "application/apply-patch+yaml"); char *patch = Generic_patchResource(genericClient, "test", patchBody, NULL, NULL, NULL, NULL, contentType); printf("%s\n", patch); - list_free(contentType); + list_freeList(contentType); free(patch); char *del = Generic_deleteResource(genericClient, "test"); diff --git a/examples/multi_thread/create_pod.c b/examples/multi_thread/create_pod.c index 00f7b78..6e01781 100644 --- a/examples/multi_thread/create_pod.c +++ b/examples/multi_thread/create_pod.c @@ -14,25 +14,25 @@ static void create_a_pod(apiClient_t * apiClient) podinfo->metadata->name = strdup("test-pod-8"); /* set containers for pod */ - list_t *containerlist = list_create(); + list_t *containerlist = list_createList(); v1_container_t *con = calloc(1, sizeof(v1_container_t)); con->name = strdup("my-container"); con->image = strdup("ubuntu:latest"); con->image_pull_policy = strdup("IfNotPresent"); /* set command for container */ - list_t *commandlist = list_create(); + list_t *commandlist = list_createList(); char *cmd = strdup("sleep"); list_addElement(commandlist, cmd); con->command = commandlist; - list_t *arglist = list_create(); + list_t *arglist = list_createList(); char *arg1 = strdup("3600"); list_addElement(arglist, arg1); con->args = arglist; /* set volume mounts for container */ - list_t *volumemounts = list_create(); + list_t *volumemounts = list_createList(); v1_volume_mount_t *volmou = calloc(1, sizeof(v1_volume_mount_t)); volmou->mount_path = strdup("/test"); volmou->name = strdup("test"); @@ -43,7 +43,7 @@ static void create_a_pod(apiClient_t * apiClient) podinfo->spec->containers = containerlist; /* set volumes for pod */ - list_t *volumelist = list_create(); + list_t *volumelist = list_createList(); v1_volume_t *volume = calloc(1, sizeof(v1_volume_t)); volume->name = strdup("test"); diff --git a/kubernetes/config/authn_plugin/plugins/oidc/libkubernetes_oidc.c b/kubernetes/config/authn_plugin/plugins/oidc/libkubernetes_oidc.c index a4d574a..bffd3c6 100644 --- a/kubernetes/config/authn_plugin/plugins/oidc/libkubernetes_oidc.c +++ b/kubernetes/config/authn_plugin/plugins/oidc/libkubernetes_oidc.c @@ -173,7 +173,7 @@ static int refresh_oidc_token(kubeconfig_property_t * auth_provider, const char return -1; } - list_t *content_type = list_create(); + list_t *content_type = list_createList(); if (!content_type) { fprintf(stderr, "%s: Cannot create list for content type.[%s]\n", fname, strerror(errno)); return -1; @@ -193,7 +193,7 @@ static int refresh_oidc_token(kubeconfig_property_t * auth_provider, const char memset(basic_token_buffer, 0, sizeof(basic_token_buffer)); snprintf(basic_token_buffer, sizeof(basic_token_buffer), BASIC_TOKEN_TEMPLATE, base64_credential); - list_t *api_keys = list_create(); + list_t *api_keys = list_createList(); if (!api_keys) { fprintf(stderr, "%s: Cannot create list for refresh token.[%s]\n", fname, strerror(errno)); rc = -1; diff --git a/kubernetes/config/incluster_config.c b/kubernetes/config/incluster_config.c index 3cf635b..333b0c2 100644 --- a/kubernetes/config/incluster_config.c +++ b/kubernetes/config/incluster_config.c @@ -128,7 +128,7 @@ static int setApiKeysInCluster(list_t ** pApiKeys) { static char fname[] = "setApiKeysInCluster()"; - list_t *apiKeys = list_create(); + list_t *apiKeys = list_createList(); if (!apiKeys) { fprintf(stderr, "%s: Cannot allocate the memory for api kyes for kubernetes service.\n", fname); return -1; diff --git a/kubernetes/config/kube_config.c b/kubernetes/config/kube_config.c index b031b9e..3fbabab 100644 --- a/kubernetes/config/kube_config.c +++ b/kubernetes/config/kube_config.c @@ -85,7 +85,7 @@ static int setApiKeys(list_t ** pApiKeys, const char *token) { static char fname[] = "setApiKeys()"; - list_t *apiKeys = list_create(); + list_t *apiKeys = list_createList(); if (!apiKeys) { fprintf(stderr, "%s: Cannot allocate the memory for api key list for kubernetes service.\n", fname); return -1; diff --git a/kubernetes/config/kube_config_util.c b/kubernetes/config/kube_config_util.c index 672d1d5..250fa30 100644 --- a/kubernetes/config/kube_config_util.c +++ b/kubernetes/config/kube_config_util.c @@ -128,5 +128,5 @@ void clear_and_free_string_pair_list(list_t * list) keyValuePair_free(pair); pair = NULL; } - list_free(list); + list_freeList(list); } diff --git a/kubernetes/watch/watch_util.c b/kubernetes/watch/watch_util.c index 36b24a9..401544a 100644 --- a/kubernetes/watch/watch_util.c +++ b/kubernetes/watch/watch_util.c @@ -42,7 +42,7 @@ void kubernets_watch_handler(void **pData, long *pDataLen, KUBE_WATCH_EVENT_HAND { char *data = *(char **) pData; - list_t *watch_event_list = list_create(); + list_t *watch_event_list = list_createList(); if (!watch_event_list) { fprintf(stderr, "Cannot create a list for watch events.\n"); return;