diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/artifactory.c | 14 | ||||
-rw-r--r-- | src/conda.c | 8 | ||||
-rw-r--r-- | src/deliverable.c | 148 | ||||
-rw-r--r-- | src/docker.c | 2 | ||||
-rw-r--r-- | src/environment.c | 8 | ||||
-rw-r--r-- | src/ini.c | 22 | ||||
-rw-r--r-- | src/main.c | 32 | ||||
-rw-r--r-- | src/recipe.c | 2 | ||||
-rw-r--r-- | src/str.c | 22 | ||||
-rw-r--r-- | src/strlist.c | 6 | ||||
-rw-r--r-- | src/system.c | 2 | ||||
-rw-r--r-- | src/template.c | 4 | ||||
-rw-r--r-- | src/utils.c | 8 |
13 files changed, 139 insertions, 139 deletions
diff --git a/src/artifactory.c b/src/artifactory.c index 39a662d..61ae911 100644 --- a/src/artifactory.c +++ b/src/artifactory.c @@ -245,8 +245,8 @@ int jfrog_cli(struct JFRT_Auth *auth, char *args) { } } } - guard_free(auth_args) - guard_strlist_free(arg_map) + guard_free(auth_args); + guard_strlist_free(arg_map); // Pings are noisy. Squelch them. if (!strstr(args, "rt ping")) { @@ -350,8 +350,8 @@ int jfrog_cli_rt_download(struct JFRT_Auth *auth, struct JFRT_Download *ctx, cha } snprintf(cmd, sizeof(cmd) - 1, "rt download %s '%s' %s", args, repo_path, dest ? dest : ""); - guard_free(args) - guard_strlist_free(arg_map) + guard_free(args); + guard_strlist_free(arg_map); int status = jfrog_cli_rt(auth, cmd); return status; @@ -426,7 +426,7 @@ int jfrog_cli_rt_upload(struct JFRT_Auth *auth, struct JFRT_Upload *ctx, char *s } } base = join(&components->data[max_components], "/"); - guard_free(components->data[max_components]) + guard_free(components->data[max_components]); new_src = join(components->data, "/"); } @@ -440,8 +440,8 @@ int jfrog_cli_rt_upload(struct JFRT_Auth *auth, struct JFRT_Upload *ctx, char *s } snprintf(cmd, sizeof(cmd) - 1, "rt upload %s '%s' \"%s\"", args, src, repo_path); - guard_free(args) - guard_strlist_free(arg_map) + guard_free(args); + guard_strlist_free(arg_map); int status = jfrog_cli_rt(auth, cmd); if (new_src) { diff --git a/src/conda.c b/src/conda.c index 87b32d4..f6d1420 100644 --- a/src/conda.c +++ b/src/conda.c @@ -185,12 +185,12 @@ int conda_check_required() { } } if (found < (sizeof(tools) / sizeof(*tools)) - 1) { - guard_free(cmd_out) - guard_strlist_free(result) + guard_free(cmd_out); + guard_strlist_free(result); return 1; } - guard_free(cmd_out) - guard_strlist_free(result) + guard_free(cmd_out); + guard_strlist_free(result); } else { msg(OMC_MSG_ERROR | OMC_MSG_L2, "The base package requirement check could not be performed\n"); return 2; diff --git a/src/deliverable.c b/src/deliverable.c index 7ff0151..8eff045 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -42,7 +42,7 @@ static void conv_strlist(struct StrList **x, char *tok, union INIVal val) { if (tplop) { strip(tplop); strlist_append_tokenize((*x), tplop, tok); - guard_free(tplop) + guard_free(tplop); } } @@ -58,7 +58,7 @@ int delivery_init_tmpdir(struct Delivery *ctx) { x = getenv("TMPDIR"); if (x) { - guard_free(ctx->storage.tmpdir) + guard_free(ctx->storage.tmpdir); tmpdir = strdup(x); } else { tmpdir = ctx->storage.tmpdir; @@ -110,72 +110,72 @@ int delivery_init_tmpdir(struct Delivery *ctx) { } void delivery_free(struct Delivery *ctx) { - guard_free(ctx->system.arch) - guard_free(ctx->meta.name) - guard_free(ctx->meta.version) - guard_free(ctx->meta.codename) - guard_free(ctx->meta.mission) - guard_free(ctx->meta.python) - guard_free(ctx->meta.mission) - guard_free(ctx->meta.python_compact) - guard_runtime_free(ctx->runtime.environ) - guard_free(ctx->storage.root) - guard_free(ctx->storage.tmpdir) - guard_free(ctx->storage.delivery_dir) - guard_free(ctx->storage.tools_dir) - guard_free(ctx->storage.package_dir) - guard_free(ctx->storage.conda_install_prefix) - guard_free(ctx->storage.conda_artifact_dir) - guard_free(ctx->storage.conda_staging_dir) - guard_free(ctx->storage.conda_staging_url) - guard_free(ctx->storage.wheel_artifact_dir) - guard_free(ctx->storage.wheel_staging_dir) - guard_free(ctx->storage.wheel_staging_url) - guard_free(ctx->storage.build_dir) - guard_free(ctx->storage.build_recipes_dir) - guard_free(ctx->storage.build_sources_dir) - guard_free(ctx->storage.build_testing_dir) - guard_free(ctx->storage.mission_dir) - guard_free(ctx->info.time_str_epoch) - guard_free(ctx->info.build_name) - guard_free(ctx->info.build_number) - guard_free(ctx->info.release_name) - guard_free(ctx->conda.installer_baseurl) - guard_free(ctx->conda.installer_name) - guard_free(ctx->conda.installer_version) - guard_free(ctx->conda.installer_platform) - guard_free(ctx->conda.installer_arch) - guard_free(ctx->conda.tool_version) - guard_free(ctx->conda.tool_build_version) - guard_strlist_free(ctx->conda.conda_packages) - guard_strlist_free(ctx->conda.conda_packages_defer) - guard_strlist_free(ctx->conda.pip_packages) - guard_strlist_free(ctx->conda.pip_packages_defer) + guard_free(ctx->system.arch); + guard_free(ctx->meta.name); + guard_free(ctx->meta.version); + guard_free(ctx->meta.codename); + guard_free(ctx->meta.mission); + guard_free(ctx->meta.python); + guard_free(ctx->meta.mission); + guard_free(ctx->meta.python_compact); + guard_runtime_free(ctx->runtime.environ); + guard_free(ctx->storage.root); + guard_free(ctx->storage.tmpdir); + guard_free(ctx->storage.delivery_dir); + guard_free(ctx->storage.tools_dir); + guard_free(ctx->storage.package_dir); + guard_free(ctx->storage.conda_install_prefix); + guard_free(ctx->storage.conda_artifact_dir); + guard_free(ctx->storage.conda_staging_dir); + guard_free(ctx->storage.conda_staging_url); + guard_free(ctx->storage.wheel_artifact_dir); + guard_free(ctx->storage.wheel_staging_dir); + guard_free(ctx->storage.wheel_staging_url); + guard_free(ctx->storage.build_dir); + guard_free(ctx->storage.build_recipes_dir); + guard_free(ctx->storage.build_sources_dir); + guard_free(ctx->storage.build_testing_dir); + guard_free(ctx->storage.mission_dir); + guard_free(ctx->info.time_str_epoch); + guard_free(ctx->info.build_name); + guard_free(ctx->info.build_number); + guard_free(ctx->info.release_name); + guard_free(ctx->conda.installer_baseurl); + guard_free(ctx->conda.installer_name); + guard_free(ctx->conda.installer_version); + guard_free(ctx->conda.installer_platform); + guard_free(ctx->conda.installer_arch); + guard_free(ctx->conda.tool_version); + guard_free(ctx->conda.tool_build_version); + guard_strlist_free(ctx->conda.conda_packages); + guard_strlist_free(ctx->conda.conda_packages_defer); + guard_strlist_free(ctx->conda.pip_packages); + guard_strlist_free(ctx->conda.pip_packages_defer); for (size_t i = 0; i < sizeof(ctx->tests) / sizeof(ctx->tests[0]); i++) { - guard_free(ctx->tests[i].name) - guard_free(ctx->tests[i].version) - guard_free(ctx->tests[i].repository) - guard_free(ctx->tests[i].repository_info_ref) - guard_free(ctx->tests[i].repository_info_tag) - guard_free(ctx->tests[i].script) - guard_free(ctx->tests[i].build_recipe) + guard_free(ctx->tests[i].name); + guard_free(ctx->tests[i].version); + guard_free(ctx->tests[i].repository); + guard_free(ctx->tests[i].repository_info_ref); + guard_free(ctx->tests[i].repository_info_tag); + guard_free(ctx->tests[i].script); + guard_free(ctx->tests[i].build_recipe); // test-specific runtime variables - guard_runtime_free(ctx->tests[i].runtime.environ) + guard_runtime_free(ctx->tests[i].runtime.environ); } - guard_free(ctx->rules.release_fmt) - guard_free(ctx->rules.build_name_fmt) - guard_free(ctx->rules.build_number_fmt) + guard_free(ctx->rules.release_fmt); + guard_free(ctx->rules.build_name_fmt); + guard_free(ctx->rules.build_number_fmt); ini_free(&ctx->rules._handle); - guard_free(ctx->deploy.docker.registry) - guard_free(ctx->deploy.docker.image_compression) - guard_strlist_free(ctx->deploy.docker.tags) - guard_strlist_free(ctx->deploy.docker.build_args) + guard_free(ctx->deploy.docker.registry); + guard_free(ctx->deploy.docker.image_compression); + guard_strlist_free(ctx->deploy.docker.tags); + guard_strlist_free(ctx->deploy.docker.build_args); for (size_t i = 0; i < sizeof(ctx->deploy.jfrog) / sizeof(ctx->deploy.jfrog[0]); i++) { - guard_strlist_free(ctx->deploy.jfrog[i].files) + guard_strlist_free(ctx->deploy.jfrog[i].files); } } @@ -214,7 +214,7 @@ void delivery_init_dirs(struct Delivery *ctx) { if (delivery_init_tmpdir(ctx)) { msg(OMC_MSG_ERROR | OMC_MSG_L1, "Set $TMPDIR to a location other than %s\n", globals.tmpdir); if (globals.tmpdir) - guard_free(globals.tmpdir) + guard_free(globals.tmpdir); exit(1); } @@ -354,7 +354,7 @@ int delivery_init(struct Delivery *ctx, struct INIFILE *ini, struct INIFILE *cfg char *jfrepo = getenv("OMC_JF_REPO"); if (jfrepo) { if (globals.jfrog.repo) { - guard_free(globals.jfrog.repo) + guard_free(globals.jfrog.repo); } globals.jfrog.repo = strdup(jfrepo); } @@ -418,7 +418,7 @@ int delivery_init(struct Delivery *ctx, struct INIFILE *ini, struct INIFILE *cfg if (!ctx->meta.python) { ini_getval(ini, "meta", "python", INIVAL_TYPE_STR, &val); conv_str(&ctx->meta.python, val); - guard_free(ctx->meta.python_compact) + guard_free(ctx->meta.python_compact); ctx->meta.python_compact = to_short_version(ctx->meta.python); } @@ -821,7 +821,7 @@ int delivery_build_recipes(struct Delivery *ctx) { } } if (recipe_dir) { - guard_free(recipe_dir) + guard_free(recipe_dir); } } return 0; @@ -1264,10 +1264,10 @@ void delivery_rewrite_spec(struct Delivery *ctx, char *filename) { } for (size_t i = 0; contents[i] != NULL; i++) { - guard_free(contents[i]) + guard_free(contents[i]); } - guard_free(contents) - guard_free(header) + guard_free(contents); + guard_free(header); fflush(tp); fclose(tp); @@ -1277,7 +1277,7 @@ void delivery_rewrite_spec(struct Delivery *ctx, char *filename) { exit(1); } remove(tempfile); - guard_free(tempfile) + guard_free(tempfile); // Replace "local" channel with the staging URL if (ctx->storage.conda_staging_url) { @@ -1388,7 +1388,7 @@ void delivery_tests_run(struct Delivery *ctx) { if (strcmp(cmd_rendered, cmd) != 0) { strcpy(cmd, cmd_rendered); } - guard_free(cmd_rendered) + guard_free(cmd_rendered); } status = shell(&proc, cmd); @@ -1568,13 +1568,13 @@ int delivery_mission_render_files(struct Delivery *ctx) { fp = fopen(data.src, "rb"); if (!fp) { perror(data.src); - guard_free(contents) + guard_free(contents); continue; } if (fread(contents, st.st_size, sizeof(*contents), fp) < 1) { perror("while reading template file"); - guard_free(contents) + guard_free(contents); fclose(fp); continue; } @@ -1582,14 +1582,14 @@ int delivery_mission_render_files(struct Delivery *ctx) { msg(OMC_MSG_L3, "Writing %s\n", data.dest); if (tpl_render_to_file(contents, data.dest)) { - guard_free(contents) + guard_free(contents); continue; } - guard_free(contents) + guard_free(contents); } - guard_free(data.src) - guard_free(data.dest) + guard_free(data.src); + guard_free(data.dest); return 0; } diff --git a/src/docker.c b/src/docker.c index 955428b..32413aa 100644 --- a/src/docker.c +++ b/src/docker.c @@ -151,7 +151,7 @@ int docker_capable(struct DockerCapabilities *result) { if (version && startswith(version, "podman")) { result->podman = true; } - guard_free(version) + guard_free(version); if (!docker_exec("buildx build --help", OMC_DOCKER_QUIET)) { result->build |= OMC_DOCKER_BUILD; diff --git a/src/environment.c b/src/environment.c index 391807f..67f8069 100644 --- a/src/environment.c +++ b/src/environment.c @@ -116,7 +116,7 @@ void runtime_export(RuntimeEnv *env, char **keys) { sprintf(output, "%s %s=\"%s\"", export_command, key, value ? value : ""); puts(output); } - guard_free(value) + guard_free(value); split_free(pair); } } @@ -352,7 +352,7 @@ char *runtime_expand_var(RuntimeEnv *env, char *input) { // Append expanded environment variable to output strncat(expanded, tmp, strlen(tmp)); if (env) { - guard_free(tmp) + guard_free(tmp); } } @@ -416,8 +416,8 @@ void runtime_set(RuntimeEnv *env, const char *_key, char *_value) { } else { strlist_set(env, key_offset, now); } - guard_free(now) - guard_free(key) + guard_free(now); + guard_free(key); } /** @@ -225,17 +225,17 @@ void ini_free(struct INIFILE **ini) { for (size_t section = 0; section < (*ini)->section_count; section++) { for (size_t data = 0; data < (*ini)->section[section]->data_count; data++) { if ((*ini)->section[section]->data[data]) { - guard_free((*ini)->section[section]->data[data]->key) - guard_free((*ini)->section[section]->data[data]->value) - guard_free((*ini)->section[section]->data[data]) + guard_free((*ini)->section[section]->data[data]->key); + guard_free((*ini)->section[section]->data[data]->value); + guard_free((*ini)->section[section]->data[data]); } } - guard_free((*ini)->section[section]->data) - guard_free((*ini)->section[section]->key) - guard_free((*ini)->section[section]) + guard_free((*ini)->section[section]->data); + guard_free((*ini)->section[section]->key); + guard_free((*ini)->section[section]); } - guard_free((*ini)->section) - guard_free((*ini)) + guard_free((*ini)->section); + guard_free((*ini)); } struct INIFILE *ini_open(const char *filename) { @@ -302,7 +302,7 @@ struct INIFILE *ini_open(const char *filename) { // Ignore default section because we already have an implicit one if (!strncmp(section_name, "default", strlen("default"))) { - guard_free(section_name) + guard_free(section_name); continue; } @@ -312,7 +312,7 @@ struct INIFILE *ini_open(const char *filename) { // Record the name of the section. This is used until another section is found. strcpy(current_section, section_name); - guard_free(section_name) + guard_free(section_name); continue; } @@ -322,7 +322,7 @@ struct INIFILE *ini_open(const char *filename) { // no data, skip if (!reading_value && isempty(line)) { - guard_free(value) + guard_free(value); continue; } @@ -122,20 +122,20 @@ static void usage(char *progname) { } void globals_free() { - guard_free(globals.tmpdir) - guard_free(globals.sysconfdir) - guard_free(globals.conda_install_prefix) - guard_strlist_free(globals.conda_packages) - guard_strlist_free(globals.pip_packages) - guard_free(globals.sysconfdir) - guard_free(globals.jfrog.arch) - guard_free(globals.jfrog.os) - guard_free(globals.jfrog.repo) - guard_free(globals.jfrog.version) - guard_free(globals.jfrog.cli_major_ver) - guard_free(globals.jfrog.jfrog_artifactory_base_url) - guard_free(globals.jfrog.jfrog_artifactory_product) - guard_free(globals.jfrog.remote_filename) + guard_free(globals.tmpdir); + guard_free(globals.sysconfdir); + guard_free(globals.conda_install_prefix); + guard_strlist_free(globals.conda_packages); + guard_strlist_free(globals.pip_packages); + guard_free(globals.sysconfdir); + guard_free(globals.jfrog.arch); + guard_free(globals.jfrog.os); + guard_free(globals.jfrog.repo); + guard_free(globals.jfrog.version); + guard_free(globals.jfrog.cli_major_ver); + guard_free(globals.jfrog.jfrog_artifactory_base_url); + guard_free(globals.jfrog.jfrog_artifactory_product); + guard_free(globals.jfrog.remote_filename); } int main(int argc, char *argv[], char *arge[]) { @@ -277,7 +277,7 @@ int main(int argc, char *argv[], char *arge[]) { // Override Python version from command-line, if any if (strlen(python_override_version)) { - guard_free(ctx.meta.python) + guard_free(ctx.meta.python); ctx.meta.python = strdup(python_override_version); guard_free(ctx.meta.python_compact); ctx.meta.python_compact = to_short_version(ctx.meta.python); @@ -524,7 +524,7 @@ int main(int argc, char *argv[], char *arge[]) { delivery_free(&ctx); globals_free(); tpl_free(); - guard_free(config_input) + guard_free(config_input); msg(OMC_MSG_L1, "Done!\n"); return 0; diff --git a/src/recipe.c b/src/recipe.c index 1f8ddb7..43899b8 100644 --- a/src/recipe.c +++ b/src/recipe.c @@ -26,7 +26,7 @@ int recipe_clone(char *recipe_dir, char *url, char *gitref, char **result) { exit(1); } if (rmtree(destdir)) { - guard_free(*result) + guard_free(*result); *result = NULL; return -1; } @@ -134,7 +134,7 @@ long int strchroff(const char *sptr, int ch) { } result = tmp - orig; - guard_free(orig) + guard_free(orig); return result; } @@ -204,7 +204,7 @@ char** split(char *_sptr, const char* delim, size_t max) // Preallocate enough records based on the number of delimiters char **result = (char **)calloc(split_alloc + 2, sizeof(char *)); if (!result) { - guard_free(sptr) + guard_free(sptr); return NULL; } @@ -226,7 +226,7 @@ char** split(char *_sptr, const char* delim, size_t max) break; } else { if (!result[i]) { - guard_free(sptr_begin) + guard_free(sptr_begin); return NULL; } strcpy(result[i], token); @@ -235,7 +235,7 @@ char** split(char *_sptr, const char* delim, size_t max) --x; //memcpy(result[i], token, strlen(token) + 1); // copy the string contents into the record } - guard_free(sptr_begin) + guard_free(sptr_begin); sptr_begin = NULL; sptr = NULL; return result; @@ -247,9 +247,9 @@ char** split(char *_sptr, const char* delim, size_t max) */ void split_free(char **ptr) { for (int i = 0; ptr[i] != NULL; i++) { - guard_free(ptr[i]) + guard_free(ptr[i]); } - guard_free(ptr) + guard_free(ptr); } /** @@ -361,9 +361,9 @@ char *join_ex(char *separator, ...) { if (i < (argc - 1)) { strcat(result, separator); } - guard_free(argv[i]) + guard_free(argv[i]); } - guard_free(argv) + guard_free(argv); return result; } @@ -568,9 +568,9 @@ char **strdeldup(char **arr) { result[rec] = strdup(arr[i]); if (!result[rec]) { for (size_t die = 0; result[die] != NULL; die++) { - guard_free(result[die]) + guard_free(result[die]); } - guard_free(result) + guard_free(result); return NULL; } @@ -767,7 +767,7 @@ char *normalize_space(char *s) { // Rewrite the input string strcpy(result, tmp_orig); - guard_free(tmp_orig) + guard_free(tmp_orig); return result; } diff --git a/src/strlist.c b/src/strlist.c index ac9fd82..5832802 100644 --- a/src/strlist.c +++ b/src/strlist.c @@ -105,13 +105,13 @@ int strlist_append_file(struct StrList *pStrList, char *_path, ReaderFn *readerF fatal: if (from_file_tmpdir != NULL) { rmtree(from_file_tmpdir); - guard_free(from_file_tmpdir) + guard_free(from_file_tmpdir); } if (filename != NULL) { - guard_free(filename) + guard_free(filename); } if (path != NULL) { - guard_free(path) + guard_free(path); } return retval; diff --git a/src/system.c b/src/system.c index 17b9a13..43236a1 100644 --- a/src/system.c +++ b/src/system.c @@ -93,7 +93,7 @@ int shell(struct Process *proc, char *args) { proc->returncode = status; } - guard_free(t_name) + guard_free(t_name); return WEXITSTATUS(status); } diff --git a/src/template.c b/src/template.c index 2314dbb..4fff31c 100644 --- a/src/template.c +++ b/src/template.c @@ -183,7 +183,7 @@ int tpl_render_to_file(char *str, const char *filename) { // Open the destination file for writing fp = fopen(filename, "w+"); if (!fp) { - guard_free(result) + guard_free(result); return -1; } @@ -191,6 +191,6 @@ int tpl_render_to_file(char *str, const char *filename) { fprintf(fp, "%s", result); fclose(fp); - guard_free(result) + guard_free(result); return 0; }
\ No newline at end of file diff --git a/src/utils.c b/src/utils.c index 0261086..c059757 100644 --- a/src/utils.c +++ b/src/utils.c @@ -23,7 +23,7 @@ int popd() { } dirstack_len--; result = chdir(dirstack[dirstack_len]); - guard_free(dirstack[dirstack_len]) + guard_free(dirstack[dirstack_len]); return result; } @@ -197,7 +197,7 @@ char **file_readlines(const char *filename, size_t start, size_t limit, ReaderFn } if (!lines) { - guard_free(buffer) + guard_free(buffer); if (!use_stdin) { fclose(fp); } @@ -249,7 +249,7 @@ char **file_readlines(const char *filename, size_t start, size_t limit, ReaderFn memset(buffer, '\0', OMC_BUFSIZ); } - guard_free(buffer) + guard_free(buffer); if (!use_stdin) { fclose(fp); } @@ -285,7 +285,7 @@ char *find_program(const char *name) { break; } path = path_orig; - guard_free(path) + guard_free(path); return strlen(result) ? result : NULL; } |